0

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)
MrMegaM
  • 1
  • 1
  • 2
    could you provide your Fit data -> `dput()` – TarJae Jan 30 '23 at 16:03
  • Thank you, I've added it to my original post. – MrMegaM Jan 30 '23 at 18:47
  • Now we need the output of `dput(data1)`. :-) – TarJae Jan 30 '23 at 18:48
  • Thank you for your patience. I am new at this, and it's a little confusing. The output of data1 is a data spreadsheet that has got 9200+ patients' worth of data. I am unsure how I can get that to you! – MrMegaM Jan 30 '23 at 19:33
  • 2
    Ok. go here and try to solve your task. If it is not possible you have to learn about minimal reproducible example. This will save many months in your survival time :-) – TarJae Jan 30 '23 at 19:39

0 Answers0