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 stop...
  • 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.