Missing Values in Variables: survfit and ggsurvplot

Hi, new here so please excuse me if I fall foul.

Trying to do some survival analysis of a dataset, using survfit() and ggsurvplot(). The variable I'm using is either high or low, but some of these values are missing.

I've run the same script on my Mac, and it doesn't include the missing values. But when I run it on my desktop, there are three lines on the resulting plot: high, low, and a category without a name, presumably the missing values.

I was wondering if anyone knows how why this occurs on my desktop and not my Mac.

survobject = Surv(data$time, event = data$status)
variablefit = survfit(survobject ~ variable, data = data)
ggsurvplot(variablefit, data = data, pval=TRUE, conf.int=TRUE)

Thanks for any help/tips!


In order for us to help you with your question, please provide us a minimal reprocudible example where you provide a minimal (dummy) dataset and code that can recreate the issue. One we have that, we can go from there. For help on creating a Reprex, see this guide:

Good luck!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.