Hi again, Let say I have following DF:
DF <- structure(list(Col1 = 1:20, Col2 = structure(c(1L, 5L, 2L, 2L, 1L, 2L, 3L, 5L, 2L, 1L, 3L, 3L, 5L, 5L, 1L, 3L, 4L, 3L, 3L, 5L ), .Label = c("a", "b", "c", "d", "e"), class = "factor")), .Names = c("Col1", "Col2"), row.names = c(NA, -20L), class = "data.frame") DF Now I create 3 groups like: Gr1 <- c('a', 'c', 'd') Gr2 <- c('e') Gr3 <- c('f', 'x') My goal is to split DF according to these groups. And to generate NULL (or something like that) if a particular group contains no value. So far I tried to split DF according to split() function. However it looks to me like, this split() does not offer this kind of customization. Can someone here help me how to split my data.frame according to this criteria? Thanks and regards, [[alternative HTML version deleted]] ______________________________________________ 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.