Created
November 12, 2020 21:08
-
-
Save kleinlennart/70d23adcf4bbdd9f91ba1ceeb3696507 to your computer and use it in GitHub Desktop.
Add Total Tweet Count per User to twitter dataset, user aggregation level
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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