From example from a data.frame:
x = data.frame(c(1,1,2,2,3,3), c(1,2,1,2,1,2), c(1,1,1,2,2,2), c(12,14,22,24,34,28)) colnames(x)=c(\"Store\",\"Dept\",\"Year\",\"
Something like :
tapply(X = x[["Sales"]], INDEX = x[setdiff(names(x), "Sales")], FUN = identity)
could work, but it is a bit strange to use tapply with the identity function.
tapply