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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

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.