Hi, I'm sure this should be simple but I can't figure it out! I want to get the median survival calculated by the survfit function and use the value rather than just be able to print it. Something like this:
library(survival) data(lung) lung.byPS = survfit(Surv (time, status) ~ ph.ecog, data=lung) # lung.byPS Call: survfit(formula = Surv(time, status) ~ ph.ecog, data = lung) 1 observation deleted due to missingness n events median 0.95LCL 0.95UCL ph.ecog=0 63 37 394 348 574 ph.ecog=1 113 82 306 268 429 ph.ecog=2 50 44 199 156 288 ph.ecog=3 1 1 118 Inf Inf What I want is to be able to call the median using something like: lung.byPS$median[ph.ecog=0] so that I can add it to a plot like this: plot (lung.byPS, conf.int=F, lty=1:4, ) abline(h=0.5, lty=5) abline(v=lung.byPS$median[ph.ecog=1]) abline(v=lung.byPS$median[ph.ecog=2]) Anyone got any easy solutions? Its fairly normal to plot across and down to show medians on survival curves... so I'm sure it must be possible to automate. Ta Calum ******************************************************************************************************************** This message may contain confidential information. If yo...{{dropped:21}} ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.