Re: [R] Basic aggregate help

2008-10-09 Thread jim holtman
Is this what you want: > x <- data.frame(Name=c("A","A","C"), Category=c("a","a","b"), > Quantity=c(1,2,3)) > aggregate(x$Quantity, list(x$Name, x$Category), FUN=sum) Group.1 Group.2 x 1 A a 3 2 C b 3 > 'by' is "a list of grouping elements, each as long as the variables

[R] Basic aggregate help

2008-10-09 Thread rkevinburton
>From what I read this should work. So please help my misunderstanding: > x <- data.frame(Name=c("A","A","C"), Category=c("a","a","b"), > Quantity=c(1,2,3)) > x Name Category Quantity 1Aa1 2Aa2 3Cb3 > aggregate(x, by=as.list(setdiff(n