I am fairly new to both Power BI and R. I know Power BI can be easily integrated with R, and there is Visualization available for that also. Therefore it would be great if can use both R and Power BI together.
First, I have checked that if my R script options are proper or not. Here I have set my R home directory and R IDE. With respect to R IDE (Integrated Development Environment), I will be explaining later.
Just to confirm I have 2 R directories and in this case I am going to use the 3.4.2, and the path correctly set in Power BI.
Next I add the R visual in Power BI.
It might ask you to enable it.
Now once it is added, there will be a R script editor available at the bottom.
For the purpose of the demo, I am using one csv file, I have received from a R training from Udemy (to confirm this is purely for demo purpose).
This csv contains 3 columns: carat (Diamond Carat), clarity (Diamond Clarity) and price (Diamond Price). Our objective is to prepare a visualization, to depict if the price is always proportional with the Carat and Clarity.
I add these 3 columns in the values for the R visualization, and you can notice a Dataset cotaining the columns gets created automatically.
Next for the purpose of my visualization I un-summarize carat and price. These are numeric field, and Power BI adds the aggregation by default.
Now before I start writing the code in the editor, let me go back to R IDE. There is a option on the top right of the editor, to open it is R IDE. What it will do is open the R Studio (as that is set as the R IDE for me), and I can do the coding in R Studio.
Going back to the objective creating a visualization to depict if the price is always proportional with the Carat and Clarity.
I have this piece of code in R Studio, which use ggplot, to create this chart.
Now I just copy and paste this code in the R Script Editor in Power BI. I just do minor change in the dataset portion.
When I run the code I get the same chart. And the best part is now I can use the additional Power BI capabilities like Slider etc with this.
First, I have checked that if my R script options are proper or not. Here I have set my R home directory and R IDE. With respect to R IDE (Integrated Development Environment), I will be explaining later.
Just to confirm I have 2 R directories and in this case I am going to use the 3.4.2, and the path correctly set in Power BI.
Next I add the R visual in Power BI.
It might ask you to enable it.
Now once it is added, there will be a R script editor available at the bottom.
For the purpose of the demo, I am using one csv file, I have received from a R training from Udemy (to confirm this is purely for demo purpose).
This csv contains 3 columns: carat (Diamond Carat), clarity (Diamond Clarity) and price (Diamond Price). Our objective is to prepare a visualization, to depict if the price is always proportional with the Carat and Clarity.
I add these 3 columns in the values for the R visualization, and you can notice a Dataset cotaining the columns gets created automatically.
Next for the purpose of my visualization I un-summarize carat and price. These are numeric field, and Power BI adds the aggregation by default.
Now before I start writing the code in the editor, let me go back to R IDE. There is a option on the top right of the editor, to open it is R IDE. What it will do is open the R Studio (as that is set as the R IDE for me), and I can do the coding in R Studio.
Going back to the objective creating a visualization to depict if the price is always proportional with the Carat and Clarity.
I have this piece of code in R Studio, which use ggplot, to create this chart.
Now I just copy and paste this code in the R Script Editor in Power BI. I just do minor change in the dataset portion.
When I run the code I get the same chart. And the best part is now I can use the additional Power BI capabilities like Slider etc with this.
No comments:
Post a Comment