Dear R users,
 
Please assist me with the following problem. I have a dataset that looks like 
the following:
 
dat<-data.frame(
  'id'=rep(c(1,2,3),each=3),
  'time'=rep(c(1,2,3),3),
  'y'= c(2,2,NA,2,NA,NA,2,5,7)
) 

 
I wish to create a variable for dropout time in dataframe 'dat' such that the 
dropout time is the time to drop out by the subject as follows:
 
 
dat<-data.frame(
  'id'=rep(c(1,2,3),each=3),
  'time'=rep(c(1,2,3),3),
  'y'= c(2,2,NA,2,NA,NA,2,5,7),
  'dropout time'=c(2,2,2,1,1,1,3,3,3)
) 

Any help will be appreciated. Many thanks in advance.
 
james


      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to