我想将标签附加geom_dl
到由ggsurvplot
. 如果我使用ggsurvplot
.
library(survival)
library(survminer)
library(directlabels)
fit <- survfit(Surv(time, status) ~ disease, data = kidney)
surv_km <- ggsurvplot(fit, risk.table = TRUE)
surv_km$plot + geom_dl(aes(label = gsub('disease=','',strata)),
method = list(dl.trans(x = x + .2), "last.points"))
但是,如果我使用完整的surv_km
surv_km + geom_dl(aes(label = gsub('disease=','',strata)),
method = list(dl.trans(x = x + .2), "last.points"))
>Error in surv_km + geom_dl(aes(label = gsub("disease=", "", strata)), : non-numeric argument to binary operator In addition: Warning message: Incompatible methods ("+.ggsurv", "+.gg") for "+"