Forum Discussion
davor
8 years agoRegular Visitor
Published R reports with sourced scripts
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?
9 Replies
- TomMartensSuper UserHey,
currently it's not possible to reuse r-script files if you are using the r-script visual approach.
If you consider to create a r based custom visual then you are able to source r script files.
I guess this will get you started:
https://github.com/Microsoft/PowerBI-visuals/blob/master/Readme.md
But you have to be aware that there is still no global library that you can use for many visuals.
Hopefully this gets you started
Regards
Tom- davorRegular Visitor
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."
- TomMartensSuper UserHey,
what I mean is this:
You can source script files, if you are creating a custom visual, but you to do it for each visual that you want to use your source file.
Meaning for each custom visual you are creating, you have to source file individually.
Hopefully this clarifies my first post a bit.
Regards
Tom