Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I want to use an R script to connects to an API, and extract data into a data frame. The script is executing in R studio but I get the follwing error in power BI desk top.
Details: "Exception of type 'Microsoft.Analytics.Modules.R.ErrorHandling.RException.Primitives.NotValidRDataException' was thrown."
I created a very simple script just to test the R script as a data source and I get the same error.
steps to reproduce
1. start power bi desk top
2. get data > R script > click connect
3. In the R Script dialog enter df <- c(1,2,3).
4. click o.k.
Result:
Unable to Connect
We encountered an error while trying to connect.
Details: "Exception of type 'Microsoft.Analytics.Modules.R.ErrorHandling.RException.Primitives.NotValidRDataException' was thrown."
The script editor shows the script will run with the following R installation c:\program files\R\R-3.6.0.
Solved! Go to Solution.
Thank you for the reply. The problem was with R version R-3.6.0.
Here is the fix. File > Options and Settings > R scripting > select a lower version of R e.g. C:\Program Files\R\R-3.5.0
I can now process the results of the API call in R and connect the script to Power BI as a data source.
I posted an alternative solution here: https://community.powerbi.com/t5/Issues/R-Source-and-Scripts-in-Power-Query-do-not-work-for-R-versio...
TLDR;
add this as the first row in the R script:
Sys.setenv(R_DEFAULT_SERIALIZE_VERSION="2", R_DEFAULT_SAVE_VERSION="2")
Many thanks, works for my R-4.0.2 installation with Power BI Desktop.
Thank you for the reply. The problem was with R version R-3.6.0.
Here is the fix. File > Options and Settings > R scripting > select a lower version of R e.g. C:\Program Files\R\R-3.5.0
I can now process the results of the API call in R and connect the script to Power BI as a data source.
Just wanted to say thank you!! This worked for me as well.
Hi @annucsb ,
Based my test in Power BI Desktop, the R Scrip works fine for connect to data source using the code " iris_raw <- iris ".
Please check if you have installed an R IDE on your local computer.
You can learn more go through the links: https://www.red-gate.com/simple-talk/sql/bi/power-bi-introduction-working-with-r-scripts-in-power-bi...
https://docs.microsoft.com/en-us/power-bi/desktop-r-ide
Please understand that this link is provided “AS IS” with no warranties or guarantees of content changes, and confers no rights.
Best Regards,
Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
140 | |
113 | |
104 | |
76 | |
63 |
User | Count |
---|---|
135 | |
126 | |
110 | |
70 | |
61 |