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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
AJ_2024
Regular Visitor

R Script Error - Interactive R custom visuals in Power BI Desktop

Hi,

 

I need to build an interactive control chart in Ppower BI Desktop. I followed a step-to-step procedure as described in the community link The R code didn't result in creation of any visual... - Microsoft Fabric Community but getting an R script error as:

 

AJ_2024_1-1704380133920.png

source('./r_files/flatten_HTML.r')

############### Library Declarations ###############
libraryRequireInstall("ggplot2");
libraryRequireInstall("plotly")
####################################################

################### Actual code ####################
g = qplot(`Petal.Length`, data = Values, fill = `Species`, main = Sys.time());
####################################################

############# Create and save widget ###############
p = ggplotly(g);
internalSaveWidget(p, 'out.html');
####################################################

################ Reduce paddings ###################
ReadFullFileReplaceString('out.html', 'out.html', ',"padding":[0-9]*,', ',"padding":0,')
####################################################

 

I spent loads of time on error resolution but didn't get through. Can someone in the community help me please?

 

Thanks In Advance;

Abhi

1 ACCEPTED SOLUTION

@AJ_2024 from the error, looks like you are missing some libraries, xml2, htmlwidgets. Do you want to try installing them and see if it works. If you have already installed them and it still does not work (which happened to me), the following worked for me.

 

When I run R in PBI, the packages are accessed by PBI from C:\Users\xxxx\Library. However, when I install the packages from R studio, the installed packages get saved in C:\Users\xxxx\Documents\R\win-library\3.5. Therefore, I changed the default path of "Install to Library:" in R studio from C:\Users\xxxx\Documents\R\win-library\3.5 to C:\Users\xxxx\Library and I got the desired output.

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

4 REPLIES 4
lbendlin
Super User
Super User

You cannot bring your own renderer. Only the standard plotting device is supported.

 

Create Power BI visuals using R - Power BI | Microsoft Learn

I am a pro user, I think we can create our own custom Power BI visuals that is packaged in single .pbiviz file and can be imported into the report.

 

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwicyt_V-8WDA...

@AJ_2024 from the error, looks like you are missing some libraries, xml2, htmlwidgets. Do you want to try installing them and see if it works. If you have already installed them and it still does not work (which happened to me), the following worked for me.

 

When I run R in PBI, the packages are accessed by PBI from C:\Users\xxxx\Library. However, when I install the packages from R studio, the installed packages get saved in C:\Users\xxxx\Documents\R\win-library\3.5. Therefore, I changed the default path of "Install to Library:" in R studio from C:\Users\xxxx\Documents\R\win-library\3.5 to C:\Users\xxxx\Library and I got the desired output.

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

This worked for me. Thanks

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.