You are here: Vanderbilt Biostatistics Wiki>Main Web>Seminars>RClinic>DMEx2 (revision 1)EditAttach
jon <- data.frame(id = rep(1:10, each=10), t = rep(1:10,10), y = rnorm(100), z = ifelse(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)))
Edit | Attach | Print version | History: r2 < r1 | Backlinks | View wiki text | Edit WikiText | More topic actions...
Topic revision: r1 - 08 Nov 2006, TheresaScott
 

This site is powered by FoswikiCopyright © 2013-2022 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