In a previous blog post, we showed you how to run R scripts in Power BI to get data, transform it, and then consume it for sharing, visualization and refresh. In this blog post, we expand on that and show how to use your data, which is already in Power BI, to create R visuals and interact with them.
Note: This feature is a Preview feature in the December 2015 release of Power BI Desktop .
The R visuals in this post are calculated on a local R installation, which must be installed independently of Power BI Desktop. While you can create R visuals and interact with them in Power BI Desktop, once those visuals are published to the Power BI service, those R visual become static images. Don’t worry – we’re working to enable live rendering of R visuals in the Power BI service as well, so in the meanwhile, you can play around with the awesomeness of R visuals in this Power BI Desktop preview!
Four reasons why we’re excited about the power of R Visuals
There are all sorts of reasons to be excited about using R with Power BI Desktop, and to create really cool visuals with R visuals. Because we all like numbers, though, here is a number – four, in this case – of specific reasons we’re really excited about all this:
1. The voluminous and growing number of “out of the box” plots available in R. In the image at the beginning of this post, you can see an example of a correlation plot, which shows correlation strength between different data fields. That’s just one example, and the richness and community involvement in R allows reuse of an endless amount of visuals and functions.
2. The level of customization you can easily reach with R visuals. If you know exactly how you want to tailor your visual, in R, you can code your way to just that customization. With R visuals you have all the flexibility to take existing concepts in R, and code your way to full customization. For example: In the following image, we created a map showing different flight routes for a travel dataset.
3. The power to combine advanced analytics in visuals. You can now perform regressions, clustering, machine learning, or any calculation available in R, and use that when plotting. For example: The chart below predicts the probability of getting into differently ranked schools by performing a regression. It then displays the predicted probability with confidence interval bands.
4. You can interact with R visuals in Power BI Desktop in two ways. First, you can modify the R code, and second, you can play with the Power BI controls – change selected data, filter, cross-highlight from other visuals, or refresh data. The combination of these two ways to interact with the visual create a unique experience in which you can iteratively tweak which data you’re presenting, and customize the R visual. Once the visual is complete, you can still interact with it, cross filter, and always present fresh data with it.
How do I generate an R visual in Power BI Desktop?
In this help article you can find a step by step description of how to generate the visual shown above.
It’s important to remember the first steps mentioned there:
- Install R on the same machine on which you’re running Power BI Desktop (if it’s not already installed)
- Enable the preview of this feature under File > Options and settings > Options > Preview Features > R Scripting.
To summarize
In this blog post we saw the first steps of using R to create visualizations over Power BI data. The functionality described here is released under preview, and there is more to come, but hopefully this gives you a taste of the powerful things you can now do with R and Power BI.
R visuals are another step in enabling you to do more with R and Power BI. It’s still in preview, so stay tuned for more updates, as it will only get better!