I often apply the table-function on each column of a data frame using plyr, like this:
Using tidyverse (dplyr and purrr):
library(tidyverse) mtcars %>% map( function(x) table(x) )
Or simply:
library(tidyverse) mtcars %>% map( table )