search for: agglist

Displaying 1 result from an estimated 1 matches for "agglist".

Did you mean: ogglist
2011 Sep 26
1
producing an aggregate table of top 3 by cost
...itema", 4), rep("itemb", 2), rep("itemc", 1), rep("itemc", 3),rep("itema", 4), rep("itemb", 2), rep("itemc", 1), rep("itemc", 3)) cost <- round (rnorm(30, mean = 100, sd = 30), 2) DF <- data.frame(group, product, cost) agglist <- list(DF$product, DF$group) col1<- aggregate(DF [,3], by = agglist, sum) col2<- aggregate(aggDF [,3], by = agglist, length) (table <- cbind(col1, col2))   My question would be, how about if you wanted a table that retained only the top 1 product (e.g., item c for group 2) by group......