[R] the Surv function

Christos Hatzis christos at nuverabio.com
Wed May 2 05:42:24 CEST 2007

Try using the following (without naming the arguments) - it should work.

Surv(fup, status)

I think what is happening is that if you use one or two arguments (unnamed),
Surv assumes that you have right-censored data, with the first argument
being time and the second being status.  By specifying 'event' as you did,
Surv assumes that you have 3 arguments of "type"=counting and it is looking
for the ending time required by the counting data format and this is why you
got the error.

If you are not afraid of R code, type Surv (without the parentheses) to see
the code behind the function.


Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Jennifer Dillon
> Sent: Tuesday, May 01, 2007 11:16 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] the Surv function
> Hi,
> I'm trying to do a simple survival analysis on some data, and 
> I'm having the following problem (here's my code and the 
> error message):
> out <- Surv(fup,event=status)
> Error in Surv(fup, event = status) : argument "time2" is 
> missing, with no default
> >From reading the documentation, it seems that I should be able to 
> >simply
> write:  Surv(time1, event)  if my data is right-censored, which it is.
> Help!
> Thanks a million,
> Jen
> --
> Jennifer Dillon
> Doctoral Student
> Harvard Biostatistics
> Room 414B, Building 1
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list