Skip to content

Instantly share code, notes, and snippets.

@fernandobarbalho
Last active October 2, 2020 15:30
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fernandobarbalho/189c1f8d62f1e6c396a7c5e22e8f9a2c to your computer and use it in GitHub Desktop.
Save fernandobarbalho/189c1f8d62f1e6c396a7c5e22e8f9a2c to your computer and use it in GitHub Desktop.
Script para gerar ranking de favoritos no twitter
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