Using the eha and survival packages in R, I am using the following code to create the survival plot below:
with(dataset, plot(Surv(enter, exit, event), ylim= c(0.87, 1.0), fn = "surv", strata = Gender))
Rather than exporting the image of the plot, how can I export the X and Y values for each line on this plot? I attempted to use the following code, however it only creates a blank .csv file:
write.table((with(dataset, plot(Surv(enter, exit, event), ylim= c(0.87, 1.0), fn = "surv", strata = Gender))), file="testfit.csv", sep=',')
Thanks for any help in advance.
On a secondary note, does anyone happen to know how to make this plot look nicer in ggplot2?