Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
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...
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.