--begin inclusion --- I am trying to extract output information from the survfit function in order to generate a matrix of select output for multiple factors. Specifically, I am interested in extracting the number of events (in the output below: 106, 2, 3). The variable names represented in my function (ee) are shown below, but none of those variables correspond to the column of events as shown in the output.
----------------------------- The easiest is to use the summary function: fit <- survfit(Surv(time, status) ~ ph.ecog, data=lung) temp <- summmary(fit) temp$table records n.max n.start events median 0.95LCL 0.95UCL ph.ecog=0 63 63 63 37 394 348 574 ph.ecog=1 113 113 113 82 306 268 429 ph.ecog=2 50 50 50 44 199 156 288 ph.ecog=3 1 1 1 1 118 NA NA The table component is a matrix. Terry Therneau ______________________________________________ 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.