Re: [R] Create a time interval from a single time variable

2009-06-04 Thread Terry Therneau
-- begin included message -- I am trying to set up a data set for a survival analysis with time-varying covariates. The data is already in a long format, but does not have a variable to signify the stopping point for the interval. The variable DaysEnrolled is the variable I would like to use t

Re: [R] Create a time interval from a single time variable

2009-06-03 Thread David Winsemius
On Jun 3, 2009, at 3:58 PM, David Winsemius wrote: Not sure how to functionalize it either. What seemed promising (assuming it has first been sorted by ID and DaysEnrolled) would be three-step process: sample1$Stop <- c(sample1[2:nrow(sample1),"DaysEnrolled"],NA) # shift the DaysEnroll

Re: [R] Create a time interval from a single time variable

2009-06-03 Thread David Winsemius
Not sure how to functionalize it either. What seemed promising (assuming it has first been sorted by ID and DaysEnrolled) would be three-step process: sample1$Stop <- c(sample1[2:nrow(sample1),"DaysEnrolled"],NA) # shift the DaysEnrolled sample1$next.id <- c(sample1[2:nrow(sample1),"ID"]

[R] Create a time interval from a single time variable

2009-06-03 Thread Katschke, Adrian R
I am trying to set up a data set for a survival analysis with time-varying covariates. The data is already in a long format, but does not have a variable to signify the stopping point for the interval. The variable DaysEnrolled is the variable I would like to use to form this interval. This is w

[R] Create a time interval from a single time variable

2009-06-03 Thread Katschke, Adrian R
I am trying to set up a data set for a survival analysis with time-varying covariates. The data is already in a long format, but does not have a variable to signify the stopping point for the interval. The variable DaysEnrolled is the variable I would like to use to form this interval. This is w