Skip to content

Instantly share code, notes, and snippets.

@kleinlennart
Created November 12, 2020 21:08
Show Gist options
  • Save kleinlennart/70d23adcf4bbdd9f91ba1ceeb3696507 to your computer and use it in GitHub Desktop.
Save kleinlennart/70d23adcf4bbdd9f91ba1ceeb3696507 to your computer and use it in GitHub Desktop.
Add Total Tweet Count per User to twitter dataset, user aggregation level
add_tweet_count <- function(dat) {
return(
dat %>%
group_by(user_id) %>%
mutate(
tweet_count = n()
) %>%
ungroup() # to remove grouped_df class
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment