[Rd] Adding a survival object to a data frame (PR#10510)
edward.m at psu.ac.th
edward.m at psu.ac.th
Wed Dec 12 03:15:08 CET 2007
Full_Name: Edward McNeil
Version: 2.6.1
OS: Windows
Submission from: (NULL) (203.170.234.5)
I want to show students how the survival object looks like in R.
Reproducible example:
library(MASS)
data(Aids2)
attach(Aids2)
status <- status=="D"
stime <- death-diag
surv <- Surv(stime, status)
D <- data.frame(stime, status, surv)
head(D,20)
stime status x..i..
1 176 TRUE 176
2 67 TRUE 67
3 432 TRUE 432
4 77 TRUE 77
5 275 TRUE 275
6 373 TRUE 373
7 389 TRUE 389
8 1027 TRUE 1027
9 492 TRUE 492
10 434 TRUE 434
11 16 TRUE 16
12 308 TRUE 308
13 92 TRUE 92
14 265 TRUE 265
15 1052 FALSE 1052+
16 132 TRUE 132
17 527 TRUE 527
18 581 FALSE 581+
19 511 FALSE 511+
20 151 TRUE 151
detach(Aids2)
The 'surv' column is strangely labelled 'x..i..'.
More information about the R-devel
mailing list