Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
fverhagen
New Member

R print or summary visualization

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!

5 REPLIES 5
bice_cold
Frequent Visitor

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!

BeardyGeorge
Advocate I
Advocate I

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)
ankitpatira
Community Champion
Community Champion

@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.

 

Capture.PNG

Unrelated and doesn't answer the question (explicitly about outputting the data from an R script, not a visualisation).

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.