Forum Discussion
R script for starting.
- Anonymous10 years ago
I suspect querying the Iris data set is the closest thing to a hello world in R (it's a built in set of data on flower petal sizes, kind of the R equivalent to Adventureworks). Try this as a script.
class(iris) str(iris) IrisInput <- iris
tenaciousdata wrote:BarneyL,
Thanks for the hello world example.
Can you add how you would use the iris data in Power BI desktop and plot it.
Asking for a friend :-)
Fortunately for your friend I was testing this out earlier in the week. Here are the examples I put together based on the Iris query I'd used before.
To run these turn on the R plots in options, add it to your report page and then drag Petal.Length, Petal.Width, Septal.Length and Septal.Width into the values section. Then add code to the R script editor that appears.
Note that you need the correct libraries installed first, I did this through RStudio.
This gives a simple scatter plot:
library(ggplot2) qplot(Sepal.Width, Petal.Width, data = dataset)
And getting a bit more exotic this gives chernoff faces (my all time favourite silly chart option)
library("tcltk")
library("aplpack")
faces(dataset[1:20,1:4])The charts work well although lag more than the native PowerBi stuff, they even change if you add a slicer on species and use it.
Given the chart source is just a script I suspect you can run calculations to the input dataset, I imagine this opens up some interesting possibilities.
Thank you Anonymous
You got me cooking!
There needs to be an I owe this person a beer button in the Power BI Community.
- Anonymous10 years agoNot applicable
Glad to help out tenaciousdata.
It will be interesting to see how far people can develop these things.
Speaking of which I found this blog today which is doing pretty much what I was pondering before (using forecasting algorithms in the R visual script). I suspect I'll be using this one a lot in the future.
http://www.datamic.net/blog/dynamic-forecasting-with-power-bi-and-r