Forum Discussion

Tina_CSS's avatar
Tina_CSS
Regular Visitor
7 years ago
Solved

R Visual not working in PBI services

Hi everyone,


I created R visual in desktop (as a custom visual!), it works perfectly and once I've tried to publish it to services it gives me this error below...I have no idea what to do, I've tried everything. Seems very like half job done from Microsoft Power BI team, that you work on some R visual for 2 days and then you can't put it online, I mean what's the point???

Script Runtime Error

Loading required package: XML

Loading required package: htmlwidgets

Please upgrade the 'shiny' package to (at least) version 1.1

Loading required package: ggplot2

Loading required package: plotly

 

Attaching package: 'plotly'

 

The following object is masked from 'package:ggplot2':

 

last_plot

 

The following object is masked from 'package:stats':

 

filter

 

The following object is masked from 'package:graphics':

 

layout

 

Error in shell.exec(url) :

access to 'C:\Users\Client\Temp\RtmpKYXLAD\viewhtml1c7e1d3719/index.html' denied


Please try again later or contact support. If you contact support, please provide these details.
Activity ID: 80e43511-826d-480f-a347-de12d780a834
Request ID: 98da7e8a-0832-1117-b74f-a357432d9a95
Correlation ID: c2d5a130-4b2d-58c0-ce8b-8cc63a39774c
Time: Mon Sep 02 2019 09:55:48 GMT+0200 (stredoeurópsky letný čas)
Version: 13.0.10599.151
Cluster URI: https://wabi-europe-north-b-redirect.analysis.windows.net

 

This is my code:

 

source('./r_files/flatten_HTML.r')

############### Library Declarations ###############
libraryRequireInstall("ggplot2");
libraryRequireInstall("plotly");
####################################################

################### Actual code ####################

 

library(plotly, warn.conflicts=FALSE)
library(graphics, warn.conflicts=FALSE)
library (stats, warn.conflicts=FALSE)
library(ggplot2, warn.conflicts=FALSE)

df <- Values

a <- as.numeric(Values$NET_VALUE_IN_EURO)
b <- as.numeric(Values$NET_VALUE_IN_EURO)
Euro <- "\u20AC"
b[b>1e6] <- paste(format(round(b[b>1e6]/ 1e6, 1), trim = TRUE), "M ")
c <-with(df, paste(Values$State_Name,b,Euro))
a <-log(a)

#Set country boundaries as light grey
l <- list(color = toRGB("#ffffff"), width = 0.5)
#Specify map projection and options
g <- list(
showframe = TRUE,
framecolor='#e6e6e6',
showcoastlines = FALSE,
projection = list(type = 'orthographic'),
resolution = '100',
showcountries = TRUE,
countrycolor = '#003563',
showocean = FALSE,
showlakes = TRUE,
lakecolor = '#99c0db',
showrivers = TRUE,
rivercolor = '#99c0db'
)

p <- plot_geo(df) %>%
add_trace(z= ~Values$NET_VALUE_IN_EURO, colors = 'Blues',
text=~c, locations = ~Values$State_Code, marker = list(line = l)) %>%
colorbar(title = 'BLA') %>%
layout(title = '', geo = g)
print(p)
info()
skip()
p=ggplotly(p);
internalSaveWidget(p, 'out.html');

  • Anonymous's avatar
    Anonymous
    7 years ago

    Hi Tina_CSS ,

    I'd like to suggest you to take a look at below document about use r script in power bi service:

    Creating R visuals in the Power BI service#r-scripts-security

     

    Spoiler

    R visuals are created from R scripts, which could potentially contain code with security or privacy risks.

    These risks mainly exist in the authoring phase when the script author run the script on their own computer.

    The Power BI service applies a sandbox technology to protect users and the service from security risks.

    This sandbox approach imposes some restrictions on the R scripts running in the Power BI service, such as accessing the Internet, or accessing to other resources that are not required to create the R visual.

    For security reasons, some of r script functions has been blocked on power bi service side.(e.g. access external datasource, write/access to specific folder path, import/export file...) 

    BTW, r script code with functions you not defined clearly or too complex to calculate(execute over 60s) also not works on service side.(such as, functions with undefined option parameters, undefined clearly data type, complex looping calculation...)
    Notice: you can also check following link to confirm your packages are available on power bi service side:

    R packages in the Power BI service

     

    Regards,

    Xiaoxin Sheng

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Tina_CSS ,

    I'd like to suggest you to take a look at below document about use r script in power bi service:

    Creating R visuals in the Power BI service#r-scripts-security

     

    Spoiler

    R visuals are created from R scripts, which could potentially contain code with security or privacy risks.

    These risks mainly exist in the authoring phase when the script author run the script on their own computer.

    The Power BI service applies a sandbox technology to protect users and the service from security risks.

    This sandbox approach imposes some restrictions on the R scripts running in the Power BI service, such as accessing the Internet, or accessing to other resources that are not required to create the R visual.

    For security reasons, some of r script functions has been blocked on power bi service side.(e.g. access external datasource, write/access to specific folder path, import/export file...) 

    BTW, r script code with functions you not defined clearly or too complex to calculate(execute over 60s) also not works on service side.(such as, functions with undefined option parameters, undefined clearly data type, complex looping calculation...)
    Notice: you can also check following link to confirm your packages are available on power bi service side:

    R packages in the Power BI service

     

    Regards,

    Xiaoxin Sheng

    • Anonymous's avatar
      Anonymous
      Not applicable

      Does any one know the solution?

       

      Thank you

    • Capricornus's avatar
      Capricornus
      Frequent Visitor

      Hello!

      All the packages I used in my report are listed as supported on the link mentionned above.

      My report still don't work on the service. 😞

       

      Regards!

       

      ID d'activité: 5147c214-cb2a-43ca-853f-2f181843870e
      ID de demande: bcfed760-aff4-1528-c249-d5232575303e
      ID de corrélation: 113cfc3b-f8d7-e0d8-a7ff-683a9cadb5ed
      Heure: Thu Jun 02 2022 14:57:56 GMT-0400 (heure avancée de l’Est)
      Version du service: 13.0.18400.37
      Version du client: 2205.5.11559-train
      URI du cluster: https://wabi-canada-central-redirect.analysis.windows.net/

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    I experienced same issue. 

    Does any one know the solution?

     

    Thank you

  • Yup I'm getting the same error message, agree with the above comments, if it works on desktop it should work on service