[R] DROP OBSEVATION IN A GROUP

Peter Maclean pmaclean2011 at yahoo.com
Wed Jun 29 22:29:06 CEST 2011


People with more experience in R I need help on this. 
I would like to drop observation if they meet certain condition. In this example 
I would like to drop group 2 in "n" because the group in "Y" has more than 2 
zeroes. 
#Example
n <- c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,3)
y <- c(2,3,2,3,4,5,6,1,0,0,0,6, 2, 1, 0, 0,9,3)
z <- as.data.frame(cbind(n,y))
colnames(z) <- c("n","y")




More information about the R-help mailing list