Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

R-survival-functions do not work when published

Hi,

 

we have created an individual R-visual using the R-package "survival". 

The first step is modelling the curve with Kaplan-Meier using the function survfit:


kaplanMeierCI <- survfit(Surv(dataMod$time[], dataMod$variable[], type="mstate") ~  1)

 

After that, the predictions kaplanMeierCI$prev[,] are plotted with "plot" and "polygon". 

 

In the Power-BI-Desktop-version of the report, the visual is displayed correctly (the output is a graph with a survival curve). The visual has also been working correctly in Power-BI-Service until some days ago. 

 

Since last week, the survival-functions do not work any more after publishing the report to Power-BI-Service - the output of the functions is NA (without having changed the R-code). The visual doesn't create an error.

 

Actually, the it should be supported by Power-BI-Service: https://docs.microsoft.com/de-de/power-bi/service-r-packages-support

 

Could there be another reason why  the functions work in Power-BI-Desktop but not in Power-BI-Service? 

 

Thank you and best regards

Theresa

Status: Needs Info
Comments
v-jiascu-msft
Microsoft Employee

Hi Theresa,

 

How did you create that visual? The demo below worked fine. I found it here.

library(survival)
dataset$SurvObj <- with(dataset, Surv(time, status == 2))
km.as.one <- survfit(dataset$SurvObj ~ 1, data = dataset, conf.type = "log-log")
plot(km.as.one)

R_survival_functions_do_not_work_when_published

 

 

Best Regards,

Dale

Vicky_Song
Impactful Individual
Status changed to: Needs Info
 
TheresaH
New Member

 

Hi Dale,

 

thanks for your comment.

 

Our code is slightley different from your example because in our case, the "event" in the Surv-Object is a factor with several possible values (0 = censored, 1, 2, 3).

That's why our code is the following:

 

dataset$SurvObj <- with(dataset, Surv(time[], event[], type="mstate"))

km.as.one <- survfit(dataset$SurvObj ~ 1, data = dataset)

plot(1-km.as.one$prev[,1], xlim = c(0, 300), ylim = c(0,1), col = 'red')

points(1- (km.as.one$prev[,1] + km.as.one$prev[,2]), col = 'blue')

points(1- (km.as.one$prev[,1] + km.as.one$prev[,2] + km.as.one$prev[,1] + km.as.one$prev[,2]), col = 'green')

 

If I replace the code by

 

dataset$SurvObj <- with(dataset, Surv(time[], event[] == 1))

km.as.one <- survfit(dataset$SurvObj ~ 1, data = dataset)

plot(km.as.one)

 

(so similar to your example) everything works fine (cf. the plot on the right).

 

Best regards,

Theresa 

 

 

Example_survival.PNG