I'm self-teaching R over here, and have a problem in DataCamp that I don't understand the solution to. When you run count()
, I understand that it counts the frequency of each category, but does it automatically create a new column, n
, as well?
size_distribution <- restaurant_groups %>%
count(group_size) %>%
mutate(probability = n / sum(n))
size_distribution