Here is a reproducible exmaple.
km
is a survfit object but the ggsurvplot function return this error:
#> Error in .get_data(fit, data = data, complain = FALSE): The `data` argument should be provided either to ggsurvfit or survfit.
time <- c(5, 6, 2, 4, 4)
event <- c(1, 0, 0, 1, 1)
library(survival)
km <- survfit(Surv(time, event) ~ 1)
library(survminer)
#> 载入需要的程辑包:ggplot2
#> 载入需要的程辑包:ggpubr
#> 载入需要的程辑包:magrittr
ggsurvplot(km, conf.int = FALSE, risk.table = "nrisk_cumevents", legend = "none")
#> Error in .get_data(fit, data = data, complain = FALSE): The `data` argument should be provided either to ggsurvfit or survfit.
Created on 2018-12-25 by the reprex package (v0.2.1)