library(dplyr) #count total observations by variable 'team' df %>% count(team) # A tibble: 3 x 2 team n 1 A 3 2 B 5 3 C 4