I am currently writing code for a package in which several survival curves (grouped by some factor) are to be combined in a single plot. Survminer seems to have problems, when the formula in the survfit object is not provided directly:
library('survival')
library('survminer')
fm1 <- survfit(Surv(time, status) ~ x, data = aml)
my_formula <- Surv(time, status) ~ x
fm2 <- survfit(my_formula, data = aml)
plot(fm1) # works fine
ggsurvplot(fm1) # works fine as well - this is the expected behavior
ggsurvplot(fm2) # does not work - supposably because formula is prodided in different manner
## Error in x$formula: object of type 'symbol' is not subsettable
I suppose, survminer should handle the formula argument in a more refined way.
It would be awesome, if this issue could be fixed!
Hello!
I am currently writing code for a package in which several survival curves (grouped by some factor) are to be combined in a single plot. Survminer seems to have problems, when the formula in the survfit object is not provided directly:
I suppose, survminer should handle the formula argument in a more refined way.
It would be awesome, if this issue could be fixed!
Thanks a lot and best greetings, Sebastian