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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Woodfin
New Member

R Script Error

I wanted to test out the R script integration and ran into an error I cannot figure out how to get past.

I have R running and it will works with the basic "Iris" data set, but not for the one I want to use.

I want to access the Quandl datasets and installed the necessary Library and Package.  I create a script in RStudio and ran it and it worked as expected pulling in data from Quandl.

 

It does not work when calling from PowerBI.  I get the error " Unable to connect"  ADO.NET: R script error:  Could not find function "Quandl"

 

Looking at the PowerBI seciton I found a document that outlines the connection :  https://powerbi.microsoft.com/en-us/documentation/powerbi-desktop-r-scripts/access

 

AND... Specifally calls out this  "To run the script in Power BI Desktop, make sure the script runs successfully in a new and unmodified workspace. This means that all packages and dependencies must be explicitly loaded and run. You can use source() to run dependent scripts."

 

When I open up Rstudio or just R, the quandl package does not load automatically.  So, my long drawn out question is this.  The sample call I'm trying to make to Quandl is this:  mydata = Quandl("FRED/GDP").  Can I enter that call into the PowerBI connection and expect to return results.  Or do I reference the script I worte with the call in it called:  Quandl_GDP.  Either way neiter work, but I wanted to see which was the right path.

 

Thanks in advance

 

Rich

1 REPLY 1
Avi_Sander
Microsoft Employee
Microsoft Employee

Hi Woodfin and thanks for the feedback,

 

I think the root cause for this is that packages are not loaded explicitly.

Does your script use ' library(PACKAGENAME) ' ? if not you should add these to make sure R knows to load the required packages.

 

As for 'Source()', in case you still need to use it: this is used for running additional scripts within yours. In this case you'd need to 'SetWD()' in the script before calling it or explicitly use the full path to your script. If not then R in PBI will not locate it correctly.

 

Let us know if this helps,

thanks, Avi Sander(PBI)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.