Re: [R] survfit function - event information???

From: David Winsemius <dwinsemius_at_comcast.net>
Date: Mon, 21 Jun 2010 19:19:55 -0400

On Jun 21, 2010, at 6:50 PM, CC wrote:

> Hi all!
>
> 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.
>
> What should I be using to call the number of events?
>
> *******************
>
> *Format of the Matrix:*
>
> [,1] [,2] [,3] [,4] [,5] [6]
> [7] [8]
> [1,] "rs12082473_T" "2288" "2211" "21" "56" (Number of Events)
>
> *******************
> *CODE & Output:*
>
> ee=survfit(Surv(dta$dmi,dta$mi==1)~dta[,i],data=dta)

Couldn't you just sum dta$mi==1 at this point? Perhaps with complete.cases or na.omit surrounding an appropriate subset of data.... untested in absence of reproducible example:

sum(dta[!is.na(dta[,i])]$mi==1)

See also:
https://stat.ethz.ch/pipermail/r-help/2010-June/242478.html

> records n.max n.start *events* median 0.95LCL 0.95UCL
> dta[, i]=0 2211 2211 2211 *106 * NA NA NA
> dta[, i]=1 21 21 21 *2 * NA NA NA
> dta[, i]=2 56 56 56 * 3* NA NA NA
>
> *******************
> *Variable Names*:
>
> names(ee)
> [1] "n" "time" "n.risk" "n.event" "n.censor" "surv"
> [7] "type" "strata" "std.err" "upper" "lower"
> "conf.type"
> [13] "conf.int" "na.action" "call"
>
> ****************
>
> Thanks!
> CC

-- 
David Winsemius, MD
West Hartford, CT

______________________________________________
R-help_at_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.
Received on Mon 21 Jun 2010 - 23:23:18 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 21 Jun 2010 - 23:30:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive