# Aggregate by a data frame variable

#### jfca283

##### Member
Hello,
I want to perform the following aggregate:
Code:
aggregate(fact~cis+sex,data=subset(bbdd,cis>0 ),FUN=sum)
but using the vector zone to have multiples tables. I already did it with a loop, but that's not the purpose of R, i think:
Code:
for (i in 1:max(zone) {

nn=paste("base",i,sep="_")
assign(nn,aggregate(fact~cis+sex,data=subset(bbdd,cis>0 & zone==i ),FUN=sum))
}
I tried with lapply, but it didn't work.
Thanks for your time and interest.