Error in add median survival line to ggsurvplot

I trying add median survival line to my plot(by using argument surv.median.line), and get the same error. What is wrong?
ggsurvplot(fit, pval = FALSE, conf.int = FALSE, legend.title = "Sleep status", legend.labs = c("Good", "Bad"), risk.table = TRUE, risk.table.y.text.col = TRUE, ggtheme = theme_classic(), palette = c("Black", "Black"), linetype = "strata", censor = FALSE, ylab ="Percent Survival", xlab ="Time(months)", fun=function(y)100*y, ylim=c(0,100), surv.median.line = "hv")

That what I get:

'Error in match(x, table, nomatch = 0L) : 
  'match' requires vector arguments'

I also asked in https://stackoverflow.com/q/57025405/10569922

If you poke around the source code, it looks like survminer:::.add_surv_median() isn't compatible with arbitrary functions. In your case, however, you can change the fun argument to fun = 'pct'.

1 Like