Hi again, Let say, I have following data frame:
Dat <- structure(list(A1 = structure(c(3L, 3L, 1L, 3L, 3L, 3L, 3L, 2L, 3L, 3L, 1L, 2L, 3L, 2L, 1L, 1L, 3L, 3L, 2L, 3L, 2L, 2L, 3L, 3L, 3L, 2L, 3L, 1L, 1L, 3L), .Label = c("a", "b", "c"), class = "factor"), A2 = c(2, 3, 2, 1, 3, 3, 2, 2, 3, 1, 3, 1, 3, 3, 2, 2, 1, 2, 1, 2, 1, 3, 3, 2, 1, 2, 3, 2, 2, 2), C1 = 1:30), .Names = c("A1", "A2", "C1"), row.names = c(NA, -30L), class = "data.frame") Now my goal is : 1: Find all possible unique combinations of column 'A1' & column 'A2'. For example A1 = c, A2 = 2 is 1 unique combination. 2. For each such unique combination, calculate sum for 'A3'. Is there any direct R function to achieve this faster way? I have very large data-frame to handle with such calculation. I tried with spilt() function. However it looks to me that, it can split a data-frame w.r.t. only one column. Thanks for your suggestion ______________________________________________ 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.