I'm trying to plot survival curves for a corresponding analysis using survminer
& survival
packages. Setting risk.table = TRUE
in the ggsurvplot
command results in a warning saying 'Vectorized input to element_text()
is not officially supported. Results may be unexpected or may change in future versions of ggplot2.'
I also tried whether this issue occurs with other data which it does. Here's a simple reprex I ran on R version 4.0.3, Rstudio Version 1.2.5033:
library('survival')
library('survminer')
library('ggplot2')
lung <- survival::lung
fit<- survfit(Surv(time, status) ~ sex, data = lung)
ggsurvplot(fit, data = lung, risk.table = TRUE)
The warning doesn't occur if risk.table = FALSE
which is why I assume that the risktables argument somehow interferes with the ggplot2 x-axis formatting. In a discussion on github about whether vectorized input to element_text() should be supported in the future of ggplot2, developers seem to rather opt for a deprecation cycle https://github.com/tidyverse/ggplot2/issues/3492.
I was wondering if there currently is some way to overcome this issue since I would want to make regular use of ggsurvplot
and its risktables feature in the future. The issue also seems to occur for other plots created with ggplot2
(see github discussion above). However, in the reprex, it seems to be related to an inherent argument of ggsurvplot
which to me seems critical for future use of this function. Any supportive input would be highly appreciated.