[R] unable to get barchart of censored subjects from ggsurvplot() in survminer package, if there is no predcitor
Christopher W. Ryan
cry@n @end|ng |rom b|ngh@mton@edu
Mon Jun 17 21:53:16 CEST 2024
Hello. Running R 4.2.3 on Windows 10. Using survimer package version
survminer_0.4.9 published 2021-03-09.
I'm encountering an error with ggsurvplot() in the survminer package.
Email to the author/maintainer about 2 weeks ago has not yet resulted in
a reply.
I seem unable to produce a n.censor.table for
an unconditional (no predictor) survival curve. See code below.
Any advice?
Thanks.
--Chris Ryan, MD, MS, MSPH
library(survival)
library(survminer)
data(lung)
fit <- survfit(Surv(time, status) ~ 1, data = lung)
ggsurvplot(
fit,
data = lung,
xlab = "Time in days",
ncensor.plot = TRUE
)
## produces error "Error:
! Problem while converting geom to grob.
ℹ Error occurred in the 1st layer.
Caused by error:
! Unknown colour name: strata"
about "uknown colour name strata"
## but there are no strata
## omit ncensor.plot, and no error
ggsurvplot(
fit,
data = lung,
xlab = "Time in days",
# ncensor.plot = TRUE
)
## restore ncensor.plot = TRUE, but use a predictor in the model,
## and no error.
fit.2 <- survfit(Surv(time, status) ~ sex, data = lung)
ggsurvplot(
fit.2,
data = lung,
xlab = "Time in days",
ncensor.plot = TRUE
)
More information about the R-help
mailing list