[gblevins] >If x2 equal 2 then I want to delete all the rows for that person from >the dataframe--see Before and After below.
>Before >x1 <- c(1,1,1,2,2,3,3,3) >x2 <- c(2,3,3,1,1,4,4,2) >x3 <- data.frame(x1,x2) >> x3 > x1 x2 >1 1 2 >2 1 3 >3 1 3 >4 2 1 >5 2 1 >6 3 4 >7 3 4 >8 3 2 >After > x1 x2 >1 2 1 >2 2 1 You might try: subset(x3, !x1 %in% x1[which(x2==2)]) -- François Pinard http://pinard.progiciels-bpi.ca ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
