> library(plyr) > # Function to sum y by A-B combinations for a generic data frame > dsum <- function(d) ddply(d, .(A, B), summarise, sumY = sum(y)) See count in plyr 1.4 for a much much faster way of doing this. Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/