Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowData Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more
Do I have an option to publish R scripts as well when publishing reports?
I would like to do:
source('path/to/script.r')A workable option is to import the script files with 'Get Data' -> 'Folder', and then use something like:
eval(parse(text = as.character(dataset$Content[1])))
where 'Content' is the script file transformed to text. This is OK, as long as you don't pass lots of extra data due to the 'unique(dataset)' expression.
Obviously I could also paste the whole script, but from a code-re-use perspective it is bad practice (and the script is quite long...).
Anyway, any decent way to load scripts, or am I to hack around it?
Hi Tom, can you elaborate on:
"But you have to be aware that there is still no global library that you can use for many visuals."
Any way to adjust the current R-script-visual (i.e. make a new one based on the CORE R-script-visual)?
I am mainly thinking about removing `unique(dataset)`.
No.
I have one large script that I copy-paste in all the visuals, and then at the end only call those functions that are needed for the visual.
Best I could think of...
I also tried sourcing from the web:
source('https://raw.githubusercontent.com/.../model.r')
But it seems this is explicitely blocked:
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'
Each r-visual also seems to operate in its own VM environment, so if you export something to "C:\Reports" with one visual, the other visual doesn't see it in "C:\Reports".
If this was possible, one could use one visual to parse the code from "Get Data -> Folder", and the others could load it from "C:\Reports" when available with something like:
while (!file.exists('parsed.r')) {
Sys.sleep(0.01)
}
load('parsed.r')Pff, getting out of ideas...
Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.
Check out the May 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 16 | |
| 10 | |
| 10 | |
| 8 | |
| 7 |
| User | Count |
|---|---|
| 41 | |
| 36 | |
| 36 | |
| 28 | |
| 20 |