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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Regiso
Advocate V
Advocate V

Help! DataSource.Error: ADO.NET: R script error.

Hello, I am copying a video from @Bielite Importing Stock Data into Power BI 

I am using R 4.0.0 and RStudio 1.3.959.

Rtools, httr, rvest, xml2, BatchGetSymbols are all successfully installed

 

 

Here is my script (exactly like the video)

 

library(BatchGetSymbols)
df <- GetSP500Stocks()

tickers <- df$Tickers

result <- BatchGetSymbols(tickers, first.date = Sys.Date()-365,
last.date = Sys.Date())
result <- as.data.frame(result$df.tickers)

 

 

Here is the error message:

DataSource.Error: ADO.NET: R script error.
Loading required package: rvest
Loading required package: xml2
Error: package or namespace load failed for 'rvest':
package 'httr' was installed before R 4.0.0: please re-install it
Error: package 'rvest' could not be loaded
Execution halted

Details:
DataSourceKind=R

 

I have already reinstalled httr & rvest & xml2 and still get this message.

 

can you help me get rid of this error?

Thank you!!

 

 

 

1 ACCEPTED SOLUTION
Regiso
Advocate V
Advocate V

The problem lies in the path that Power BI follows to get the packages.

1. Go to your R IDE and find out where R goes by typing .libPaths().

2. Then, go to Power BI > Transform > R Script and see where Power BI is going

3. Make it a df <- as.data.frame(.libPaths())

4. See if Power BI has the same list you do. 

5. Add this one line to the top of your R script in Power BI  .libPaths(.libPaths()[i]) where i is the line with the address that matches your R IDE

 

6. Voila!

 

All credit for this solution goes to Stacia Varga at Plural Sight - read the blog here: Data Inspirations Solves the Power BI R path issue 

@_StaciaV_

 

View solution in original post

3 REPLIES 3
Chitemerere
Responsive Resident
Responsive Resident

Thank you very much for this post. I encountered this error today.  However I still have problems when trying to implement this.  Kindly advise format in the [i] above as I get an error message on this.  Should the address be enclosed in quotes?

 

Regards,

Chris

I keep seening this answer for this issue; however, it does not work for me. I get the same error. Anyone make it work?

Regiso
Advocate V
Advocate V

The problem lies in the path that Power BI follows to get the packages.

1. Go to your R IDE and find out where R goes by typing .libPaths().

2. Then, go to Power BI > Transform > R Script and see where Power BI is going

3. Make it a df <- as.data.frame(.libPaths())

4. See if Power BI has the same list you do. 

5. Add this one line to the top of your R script in Power BI  .libPaths(.libPaths()[i]) where i is the line with the address that matches your R IDE

 

6. Voila!

 

All credit for this solution goes to Stacia Varga at Plural Sight - read the blog here: Data Inspirations Solves the Power BI R path issue 

@_StaciaV_

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors