Skip to content

Instantly share code, notes, and snippets.

@sergiospagnuolo
Created April 22, 2021 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergiospagnuolo/48fc766edf9aa03f31c0c2a392964db7 to your computer and use it in GitHub Desktop.
Save sergiospagnuolo/48fc766edf9aa03f31c0c2a392964db7 to your computer and use it in GitHub Desktop.
library(tidyverse)
d <- read_csv("top_posts_instagram_12meses_abril2021.csv")
top_posts <- d %>%
arrange(desc(`Total Interactions`)) %>%
head(1000)
top_profiles <- d %>%
group_by(`User Name`) %>%
mutate(n_posts = n(), interacoes = sum(`Total Interactions`), comentarios = sum(Comments), likes = sum(Likes), media_overperforming = round(mean(`Overperforming Score`),2)) %>%
select(`User Name`, Account, n_posts, interacoes, comentarios, likes, media_overperforming) %>%
distinct(`User Name`, .keep_all = T) %>%
mutate(tx_engajamento = round(sum(interacoes / n_posts), 2)) %>%
arrange(desc(tx_engajamento))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment