Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

R Visuals not rendering in PBI Services

Hi Experts

 

I my R visuals are not displaying in pBI Services, these visual where fine until a few days ago (loading a working finre for a period of 9 months). I am not sure why they may have stopped displaying in PBI Services.

i have done the following steps.

1. Checked and Installed latest version of Cran R

2. Updated all the packages

3. have the most current version of desktop.

 

Not sure if i need to do anything on gateway???

 

The packages i am using in the R script in Desktop are

library(dplyr)
library(ggplot2)
library(survival)
library(survminer)
library(grid)
library(gridExtra)
  • Anonymous's avatar
    Anonymous
    6 years ago

    Team_eads

     

    1. 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...). You could refer to this doucment:
    https://docs.microsoft.com/en-us/power-bi/visuals/service-r-visuals#r-scripts-security

    The r script is not access anything from a fodler path nor import.

     

    2. R script code with functions you don't defined clearly or too complex to calculate(over 60s) also not works on service side. 

     

    All the above has been working fine for the last 9 months, this should not stop working over night.

    here is my R Script

    library(dplyr)
    library(ggplot2)
    library(survival)
    library(survminer)
    library(grid)
    library(gridExtra)
    pc <- dataset
    fstat <- pc %>% mutate(fstatus = case_when(OUTCOMETYPE=="Revised" ~ 1,TRUE ~ 0))
    pmpa <- fstat %>% select(PRIMARYPROCEDUREID,PRIMARYTOOUTCOMEYEARS,fstatus,OUTCOMETYPE)
    if(nrow(pmpa) < 4){
    d <- pmpa %>% select(PRIMARYPROCEDUREID,PRIMARYTOOUTCOMEYEARS,OUTCOMETYPE) %>% mutate(INSUFFICIENTDATA = "Summary Results")
    h = head(d[,2:4])
    grid.table(h)
    }else{
    fit <- survfit(Surv(PRIMARYTOOUTCOMEYEARS,fstatus)~1,data = pmpa)
    ggsurv <- ggsurvplot(fit,
    ylab="Patient Analysis",
    xlab="Time (Years)",
    break.time.by = 1,
    xlim = c(0,max(fit$time)),
    surv.scale = "percent",
    legend.title = "Kaplan-Meier",
    legend.labs = "",
    risk.table = FALSE,
    fontsize = 3,
    font.tickslab = c(10, "plain"),
    risk.table.y.text = FALSE,
    fun = "event"
    )
    ggsurv$plot <- ggsurv$plot + theme(plot.title = element_text(hjust = 0.5, size=18), panel.grid.major = element_line(colour = "grey90"))
    ggsurv$table <- ggsurv$table + theme(plot.title = element_text(hjust = 0.5, size = 10))
    ggsurv
    }

     

  • Anonymous's avatar
    Anonymous
    6 years ago
    Hi All

    The issues is a microsoft product problem. I have conformation Microsoft product team.

7 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      hey tom

       

      the issue was present even before i updated the R environment to 3.6.2 from 3.6.1. i have checked the Packages too and they are are supported for what i am trying to do. hence, why i am at a loss here.

  • v-eachen-msft's avatar
    v-eachen-msft
    Community Support

    Hi Anonymous ,

     

    1. 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...). You could refer to this doucment:
    https://docs.microsoft.com/en-us/power-bi/visuals/service-r-visuals#r-scripts-security

    2. R script code with functions you don't defined clearly or too complex to calculate(over 60s) also not works on service side. 

     

    You can check through the above two points.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Microsoft Team

       

      I have uploaded the file to the Power BI Pro envirnment and it work fine the previous PBIX file was also working fine in the Premium, hence by conclusion there must be a bug in the Premium Environment setting.

      • DanielKB's avatar
        DanielKB
        Regular Visitor

        We're noticing the same thing. Most of the (many) R visuals which render fine in the desktop files are not rendering in the service. 

    • Anonymous's avatar
      Anonymous
      Not applicable

      Team_eads

       

      1. 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...). You could refer to this doucment:
      https://docs.microsoft.com/en-us/power-bi/visuals/service-r-visuals#r-scripts-security

      The r script is not access anything from a fodler path nor import.

       

      2. R script code with functions you don't defined clearly or too complex to calculate(over 60s) also not works on service side. 

       

      All the above has been working fine for the last 9 months, this should not stop working over night.

      here is my R Script

      library(dplyr)
      library(ggplot2)
      library(survival)
      library(survminer)
      library(grid)
      library(gridExtra)
      pc <- dataset
      fstat <- pc %>% mutate(fstatus = case_when(OUTCOMETYPE=="Revised" ~ 1,TRUE ~ 0))
      pmpa <- fstat %>% select(PRIMARYPROCEDUREID,PRIMARYTOOUTCOMEYEARS,fstatus,OUTCOMETYPE)
      if(nrow(pmpa) < 4){
      d <- pmpa %>% select(PRIMARYPROCEDUREID,PRIMARYTOOUTCOMEYEARS,OUTCOMETYPE) %>% mutate(INSUFFICIENTDATA = "Summary Results")
      h = head(d[,2:4])
      grid.table(h)
      }else{
      fit <- survfit(Surv(PRIMARYTOOUTCOMEYEARS,fstatus)~1,data = pmpa)
      ggsurv <- ggsurvplot(fit,
      ylab="Patient Analysis",
      xlab="Time (Years)",
      break.time.by = 1,
      xlim = c(0,max(fit$time)),
      surv.scale = "percent",
      legend.title = "Kaplan-Meier",
      legend.labs = "",
      risk.table = FALSE,
      fontsize = 3,
      font.tickslab = c(10, "plain"),
      risk.table.y.text = FALSE,
      fun = "event"
      )
      ggsurv$plot <- ggsurv$plot + theme(plot.title = element_text(hjust = 0.5, size=18), panel.grid.major = element_line(colour = "grey90"))
      ggsurv$table <- ggsurv$table + theme(plot.title = element_text(hjust = 0.5, size = 10))
      ggsurv
      }

       

      • Anonymous's avatar
        Anonymous
        Not applicable
        Hi All

        The issues is a microsoft product problem. I have conformation Microsoft product team.