Last active
October 2, 2020 15:30
-
-
Save fernandobarbalho/189c1f8d62f1e6c396a7c5e22e8f9a2c to your computer and use it in GitHub Desktop.
Script para gerar ranking de favoritos no twitter
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
library(rtweet) | |
library(dplyr) | |
library(ggplot2) | |
df_favorite<- rtweet::get_favorites("@barbalhofernand", n=3000) | |
users_favorite<- | |
df_favorite %>% | |
group_by(screen_name, user_id) %>% | |
summarise( | |
quant_fav= n() | |
) | |
users_favorite %>% | |
ungroup() %>% | |
top_n(10,quant_fav) %>% | |
mutate(screen_name = reorder(screen_name,quant_fav)) %>% | |
ggplot() + | |
geom_col(aes(x= screen_name, y= quant_fav)) + | |
theme_light() + | |
coord_flip() + | |
labs( | |
title = "Gráfico da galera que eu mais favorito no twitter", | |
y = "Número de posts favoritados", | |
x= "Screen name da galera" ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment