Jonathan's problem

jon <- data.frame(id = rep(1:10, each=10),
   t = rep(1:10,10), y = rnorm(100))
jon$z <- ifelse(jpn$y <= -1, 1, 0))
junk <- subset(jon, z==1)
minvals <- with(junk, tapply(X=t, INDEX=id, FUN=min, na.rm=TRUE))
junk1 <- data.frame(id = dimnames(minvals)[[1]], mint=minvals)
junk2 <- merge(jon, junk1, by="id", all=TRUE)
junk2$flag <- ifelse(is.na(junk2$mint), 0,
   ifelse(junk2$t >= junk2$mint, 1, 0))
Topic revision: r2 - 21 Nov 2006, TheresaScott
 

This site is powered by FoswikiCopyright © 2013-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki? Send feedback