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
In data you put your dataframe and into levels your categories.
table(factor(data, levels = 1:5))