What is a good way to get the independent frequency counts of multiple columns using dplyr? I want to go from a table of values:
dplyr
# A tibble: 7
Using tabulate in base R:
tabulate
apply(df,2,function(x) tabulate(x)[min(df):max(df)]) # a b c d #[1,] 2 0 2 1 #[2,] 1 4 2 0 #[3,] 2 2 0 6 #[4,] 0 1 2 NA #[5,] 2 NA 1 NA