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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

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
Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.