Re: [R] new object

From: ronggui <ronggui.huang_at_gmail.com>
Date: Tue 11 Jul 2006 - 21:27:45 EST

> sum.out<-summary(fit)
> names(sum.out)

 [1] "surv" "time" "n.risk" "n.event" "conf.int" "std.err"  [7] "lower" "upper" "strata" "call"
> sum.out$n.risk

 [1] 11 10 8 7 5 4 2 12 10 8 6 5 4 3 2 1
> sum.out$n.event

 [1] 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1
> cbind(sum.out$n.risk,sum.out$n.event,sum.out$strata)

      [,1] [,2] [,3]

 [1,]   11    1    1
 [2,]   10    1    1
 [3,]    8    1    1
 [4,]    7    1    1
 [5,]    5    1    1
 [6,]    4    1    1
 [7,]    2    1    1
 [8,]   12    2    2
 [9,]   10    2    2
[10,]    8    1    2
[11,]    6    1    2
[12,]    5    1    2
[13,]    4    1    2
[14,]    3    1    2

[15,] 2 1 2
[16,] 1 1 2

2006/7/11, Mauricio Cardeal <mcardeal@ufba.br>:
> Hi !
>
> Please, how can I extract n.event and n.risk as a new object from
> example below ? Thanks in advance.
> Mauricio
>
> require(survival)
> fit <- survfit(Surv(time, status) ~ x, data=aml)
>
> summary(fit)
>
> Call: survfit(formula = Surv(time, status) ~ x, data = aml)
>
> x=Maintained
> time n.risk n.event survival std.err lower 95% CI upper 95% CI
> 9 11 1 0.909 0.0867 0.7541 1.000
> 13 10 1 0.818 0.1163 0.6192 1.000
> 18 8 1 0.716 0.1397 0.4884 1.000
> 23 7 1 0.614 0.1526 0.3769 0.999
> 31 5 1 0.491 0.1642 0.2549 0.946
> 34 4 1 0.368 0.1627 0.1549 0.875
> 48 2 1 0.184 0.1535 0.0359 0.944
>
> x=Nonmaintained
> time n.risk n.event survival std.err lower 95% CI upper 95% CI
> 5 12 2 0.8333 0.1076 0.6470 1.000
> 8 10 2 0.6667 0.1361 0.4468 0.995
> 12 8 1 0.5833 0.1423 0.3616 0.941
> 23 6 1 0.4861 0.1481 0.2675 0.883
> 27 5 1 0.3889 0.1470 0.1854 0.816
> 30 4 1 0.2917 0.1387 0.1148 0.741
> 33 3 1 0.1944 0.1219 0.0569 0.664
> 43 2 1 0.0972 0.0919 0.0153 0.620
> 45 1 1 0.0000 NA NA NA
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
ٹ
Department of Sociology
Fudan University



______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Received on Tue Jul 11 21:31:20 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 12 Jul 2006 - 00:20:38 EST.

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