How to indicate path to external R code on published Power BI?

154 Views Asked by At

I have a PowerBI (PBI) report created using local R code for doing some plots. Usually, the code is directly pasted within PBI but I indicate the path to the R file in my computer. This means, that in the "R script editor" from PBI I simply have a line like: source("C:/Users/Myself/PowerBI/Script_Plot01.r")

Now I want to publish this report to be on-line available but I don't know 'where' to put the r code file to be available to PowerBI. I have tried to link the source with a folder in Sharepoint, so having a line like: source(" https:// myself. sharepoint.com /PowerBI /Script_Plot01.r ")

But it doesn't work. I got the following "Script Runtime Error":

Error in file(filename, "r", encoding = encoding) : cannot open the connection
In addition: Warning message: In file(filename, "r", encoding = encoding) : InternetOpenUrl failed: 'The server name or address could not be resolved'

I want to have external sourced R code because I re-use the same code many times for multiple plots, so it is much more efficient than copy-paste it. Also, it helps on keeping everything properly updated.

I have asked this also in the PowerBI official community, but no answer. Apparently, PBI may not support this nor have a simple solution.

Therefore I wonder if there is any way from R that I can link to a sharepoint folder (or similar) where to have the code and ask R to execute it.

Many thanks for your help!

Susana.

0

There are 0 best solutions below