I want to count the number of occurrences of a factor in a data frame. For example, to count the number of events of a given type in the code below:
library(plyr
> xtabs(quantity~type, events) type A B C 3 1 0