March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
I have the following R Code which I run in Power BI Desktop:
# References:
# https://www.tutorialspoint.com/r/r_pie_charts.htm
# https://www.rdocumentation.org/packages/svDialogs/versions/1.0.0/topics/dlg_input
library(svDialogs)
title <- dlgInput("Enter Title for Report")$res
pie ( c(2, 3, 2), c("dog", "cat", "moose"), main = title)
It displays the Pie Chart just fine in Power BI, but it never prompts for user Input so the title of the report doesn't get updated.
Why isn't the Power BI hosted R Script prompting me for user input?
BTW: When I go to insert code into posts on this forum, I don't see options for F#, Power Query M, DAX or R. All of these lanaguages are relavent to this forum. I picked Java to display the above R code so I could get "Pretty Printing".
I realize this is a very old thread and the OP has probably long since figured out the solution.
Having said that, this is a known limitation in R integration in Power BI.
From https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-r-scripts: "Interactive calls in the R script, such as waiting for user input, halts the script’s execution."
Hi @Shawn_Eary ,
Whether your problem has been resolved? If yes, could you please mark it as Answered? So it will help others if they face the similar problem with you. Thank you.
Best Regards
Rena
Hi @Shawn_Eary ,
Please try to update your R code as below:
# References:
# https://www.tutorialspoint.com/r/r_pie_charts.htm
# https://www.rdocumentation.org/packages/svDialogs/versions/1.0.0/topics/dlg_input
library(svDialogs)
title <- readline(prompt="Enter Title for Report ")$res
pie ( c(2, 3, 2), c("dog", "cat", "moose"), main = title)
Best Regards
Rena
@v-yiruan-msft- readline doesn't work when run in an R Visual either. It works fine from the R Console but it doesn't work inside an R Visualization for Power BI Desktop 2.79.5768.721 64-bit (March 2020). The prompt is simply skipped and the report is displayed with no title.
I don't know if other versions of Power BI Desktop are affected but I suspect they are.
There needs to be an easy way to do the following:
NOTE: Will the developers of this website please turn spell check on for this TextArea? All they should have to do is flip a switch...
https://davidwalsh.name/spellcheck
This is slightly tangential, but when I run this RScript in a visualization, I also can't find the output of the print statements...
speed <- c(2, 3, 4)
drag <- c(4, 9, 16)
print(speed)
print(drag)
plot(speed, drag)
The script prints the speed and drag vectors out fine when run via cmd.exe using RScript.exe, but when I run it in Power BI, I can't find the print output...
BTW: I tried posting an unrelated question with a few tables more than once over the course of several days and this Forums WebApp "crashed" on me at least twice thereby throwing out the contents of the questions that I had spent notable time on... While it is certainly more competitive and "vicious", I'm beginning to wonder if the Power BI community would be better served if we completely abolished this Forum and required all Power BI users to go through StackOverflow. I understand the StackOverflow culture can sometimes feel "hostile" but this WebApp has serious usability issues... The SO interface is much more efficient and easier to use.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
125 | |
85 | |
69 | |
54 | |
45 |
User | Count |
---|---|
204 | |
106 | |
98 | |
65 | |
54 |