For a sample dataframe:
df <- structure(list(area = c("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k"),
count = c(1L, 1L, 1L, 3L, 4L, 2L, 2L, 4L, 2L, 5L, 6L)),
.Names = c("area", "count"), class = c("tbl_df", "tbl", "data.frame"),
row.names = c(NA, -11L), spec = structure(list(cols = structure(list(area = structure(list(),
class = c("collector_character", "collector")), count = structure(list(), class = c("collector_integer",
"collector"))), .Names = c("area", "count")), default = structure(list(), class = c("collector_guess",
"collector"))), .Names = c("cols", "default"), class = "col_spec"))
... which lists the number of occurrences of something per area, I wish to produce a another summary table showing how many areas have one occurrence, two occurrences, three occurrences etc. For example, there are three areas with 'One occurrence per area", three areas with 'Two occurrences per area", one area with 'Three occurrence per area" etc.
What is the best package/code to produce my desired result? I have tried with aggregate and plyr, but so far have had no success.