Summarizing user types
Since you can use the count()
wrapper, why bother counting rows in a group as part of a grouped summary? Sometimes you want a more detailed summary, and knowing how to compute a count as part of a grouped summary that mixes numeric and categorical summaries can come in handy.
Cet exercice fait partie du cours
Introduction to Text Analysis in R
Instructions
- Group
twitter_data
by whether or not a user is verified. - Compute the average number of followers for each type of user. Call this new column
avg_followers
. - Count the number of verified and non-verified users. For consistency, call this new column
n
.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
library(tidyverse)
twitter_data %>%
# Group by whether or not a user is verified
___(___) %>%
summarize(
# Compute the average number of followers
___ = ___,
# Count the number of users in each category
___ = ___
)