Showing results for 
Search instead for 
Did you mean: 
robjensen Frequent Visitor
Frequent Visitor

Cannot import multiple r-script sources in RHTML visual

I'm unable to import multiple r-script source files in RHTML visuals.  Power BI and R seem to import the first file referenced, but any subsequent source(./r_files/foo.r) calls appear to be ignored.  This behavior is not getting repeated in RStudio using the same instance of R.  Any guidance would be appreciated.


Steps to reproduce:

1) Create new visual using the RHTML template and create a new .r file in the r_files directory:


> pbiviz new sampleRHTMLVisual -t rhtml
> cd sampleRHTMLVisual
> echo $null >> .\r_files\test.r

2) Flesh out required information in pbiviz.json:




3) Insert the following code as the first line in script.r:




4) Compile and load the visual:


> pbiviz package

5) Observe the error message:

Can't display this visual.
R script error.
Error in libraryRequiredInstall("ggplot2"): could not find function "libraryRequireInstall"
Execution halted



v-evelk Established Member
Established Member

Re: Cannot import multiple r-script sources in RHTML visual



It looks like you try to create new project with non-webpack version of tools and it is probably required to set this file in tsconfig.json ('files' section).

I tried to build by your instruction with the latest version of powerbi-visuals-tools and everything looks OK.

To install the latest version of tools please run in a console the following command:

npm install -g powerbi-visuals-tools@latest

Kind Regards,

Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals

Helpful resources

Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

Top Ideas
Users Online
Currently online: 254 members 2,634 guests
Please welcome our newest community members: