Amy It would have been helpful if you had sent your R code of how you constructed the sab object.
If you have a data.frame, the subset command you are having trouble with should work fine. See below. # Working Example sab = data.frame(group=c('Group A', 'Group A', 'Group C', 'Group B', 'Group C'), gender=c(1,1,1,2,2)) subset(sab, sab$group=='Group A') Perhaps your data is stored as a matrix? If so, the following code will fail with the error message you experienced. # Non Working Example sab2 = matrix(c('Group A', 'Group A', 'Group C', 'Group B', 'Group C',1,1,1,2,2),5,2) subset(sab2, sab2$group=='Group A') HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/operator-is-invalid-for-atomic-vectors-tp3224224p3224318.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.