Re: [R] command in survival package

From: Linda Lei <llei_at_bccrc.ca>
Date: Tue 24 Jan 2006 - 04:33:25 EST


Thank you guys.
But I tried the commands and I still get:

> aml1<-aml[aml$group==1,]
> aml1

[1] time status x
<0 rows> (or 0-length row.names)
> esf.fit <- survfit(Surv(aml1$weeks,status) ~ 1)
Error in Surv(aml1$weeks, status) : Time variable is not numeric In addition: Warning message:
is.na() applied to non-(list or vector) in: is.na(time)

which still looks confusing. Or are they should be applied in s-plus instead of R?

Thanks a lot!
Linda

-----Original Message-----
From: Marc Schwartz [mailto:MSchwartz@mn.rr.com] Sent: Friday, January 20, 2006 4:49 PM
To: Thomas Lumley
Cc: Linda Lei; R-help@stat.math.ethz.ch
Subject: Re: [R] command in survival package

On Fri, 2006-01-20 at 15:27 -0800, Thomas Lumley wrote:
> On Fri, 20 Jan 2006, Linda Lei wrote:
>
> > Hi there,
> >
> >
> >
> > I have a question about one command sentence when I follow the
example
> > in the book of "Survival analysis in S":
> >
> > > aml1<-aml[aml$group==1]
>
> If this is really what the book says you should probably complain to
the
> author. However, if it says
> aml1<-aml[aml$group==1,]
> then you show type that instead.
>
> It is hard to be sure, because you don't say where the `aml' data set
> comes from. It can't be the one in the survival package as this
doesn't
> have a variable called "group"
>
> >
> > Thus, I couldn't keep going on the next command:
> >
> > esf.fit<-survfit(Surv(aml1,status)~1).
> >
>
> This looks implausible as well. I would have expected something like
> esf.fit<-survfit(Surv(time,status)~1, data=aml1)

Correct on both accounts Thomas. The text in the book on page 26 appears as Linda posted.

However, there is an errata document here:

http://www.crcpress.com/e_products/downloads/download.asp?cat_no=C4088

which shows the corrected text as:

aml1 <- aml[aml$group==1,] # Maintained group only

esf.fit <- survfit(Surv(aml1$weeks,status) ~ 1)

HTH, Marc Schwartz



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 Jan 24 04:53:29 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:09 EST