[Rd] Adding a survival object to a data frame (PR#10510)
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Dec 13 12:09:46 CET 2007
Apparently this was Surv from package Design.
So the bug is in contributed package Design, and nothing to do with
R-bugs.
On Wed, 12 Dec 2007, Peter Dalgaard wrote:
> ripley at stats.ox.ac.uk wrote:
>> Your example is not reproducible without 'library(survival)'.
>> When I include that, I get
>>
>>
>>> head(D,20)
>>>
>> stime status surv
>> 1 176 TRUE 176
>> ...
>>
>> Objects of class "Surv" are from the contributed package survival, and you
>> need that attached to deal with them properly.
>>
>>
>>
> ... but even if you detach it, you do not get the symptoms shown:
>
>> head(D,5)
> stime status surv.time surv.status
> 1 176 TRUE 176 1
> 2 67 TRUE 67 1
> 3 432 TRUE 432 1
> 4 77 TRUE 77 1
> 5 275 TRUE 275 1
>
>
>> On Wed, 12 Dec 2007, edward.m at psu.ac.th wrote:
>>
>>
>>> 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..'.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list