Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Does anyone know how you can show the result of an R script in a dashboard?
And I don't mean the charts, but for example the result of the r script :
input <- warpbreaksprint(head(input))
output <-glm(formula = breaks ~ wool+tension, data = warpbreaks, family = poisson) print(summary(output))
Thank You!
I haven't tested the solution on summary() outputs, but I have done this with a numeric output value. A way around this is to utilize ggplot() + geom_text() in order to output a text value. I used this in a predict function where:
p <- predict(fit, test.data)
ggplot() + geom_text(aes(0, 0, label = p))
That got me a plot that has my numeric value in the center. If you mess around with the arguments available for the function you can make it look a lot nicer than that. It's not great, but it works until Power BI starts allowing us to output printed values to a report.
If that works, please mark it as a solution. Thanks!
it's a bit of a workaround, but the gridExtra package should be able to do what you're after - grid.table() instead of print can be used to display the result of the summary function (see here for more detail on what it can do).
Note that this might not be completely what you're after, as it produces an image and displays that, rather than an actual table you can copy data out of.
Another way would be to save the output in a text file and then create a table visual in PowerBi and pull the data with 0 width. The issue here is one would need to refresh the table visual.
require(gridExtra) pathToProject <- "F:\\PowerBIDocuments\\" t <- summary(dataset$hwy) grid.table(t) out <- capture.output(t) cat(out, file=paste0(pathToProject,"results.txt"), sep="\n", append=FALSE)
@fverhagen In power bi desktop you can use R script visual to visualise output of R scripts. However it is currently not supported in power bi service and you will only find it working in power bi desktop. Please vote for my idea here to have R visual support in power bi service. Check this blog post on using R visuals in power bi desktop.
Unrelated and doesn't answer the question (explicitly about outputting the data from an R script, not a visualisation).
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
110 | |
102 | |
99 | |
38 | |
37 |
User | Count |
---|---|
158 | |
125 | |
76 | |
74 | |
63 |