I am trying to animate a KM plot I had drawn up, however gganimate does not seem to work. I attempted to use gganimate with my ggsurvplot function and the warning message comes up with "incompatible methods" as the error.
I used this code
ggsurvplot(Fit[c(1,3)], data = data1,
ylim = c(0.8, 1) , xlim = c(0,380), break.x.by = 73,
xlab = "Time (Days)",
pval = TRUE, pval.coord = c(0.5,0.823),
legend = "right",
ggtheme = custom_theme()) +
transition_reveal(gsurv1yr)
where gsurv1yr is the time in days. Instead I get this error
Error in ggsurvplot(Fit[c(1, 3)], data = data1, title = "Kaplan-Meier plot of 1 year Graft Survival", :
non-numeric argument to binary operator
In addition: Warning message:
Incompatible methods ("+.ggsurv", "+.gg") for "+"
Edit: As requested, Fit data as follows. It is from a large database.
Fit <- survfit(Surv(gsurv1yr, gcens1yr) ~ RETHNIC, data = data1)