-
-
Save sergiospagnuolo/1c63e752ee8bdac1cdb8a7a307761316 to your computer and use it in GitHub Desktop.
análise de dados do Crowdtangle e da API do Twitter de acordo com metodologia do Monitor Nuclear
This file contains 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(tidyverse) | |
library(lubridate) | |
library(pracma) | |
d <- read_csv("bolso_haddad.csv") | |
e <- read_csv("tx_bolso_tweets.csv") | |
d$data_publ <- lubridate::as_date(d$Created, format="%Y-%m-%d") | |
# Interacoes por dia | |
d %>% | |
select(data_publ, Type, `Total Interactions`, Comments, Likes, Love, Wow, Haha, Sad, Angry, Care, Shares, `Page Name`) %>% | |
filter(`Page Name` == "Jair Messias Bolsonaro") %>% | |
group_by(`Page Name`, data_publ) %>% | |
summarise(interacoes = sum(Likes + Love + Wow + Haha + Sad + Angry + Care + Shares)) %>% | |
ggplot(aes(data_publ, interacoes, colour = `Page Name`)) + | |
geom_point() + | |
geom_smooth(colour = "#000000", fill = "#000000") | |
# interacoes por post, por dia | |
d %>% | |
select(data_publ, Type, `Total Interactions`, Comments, Likes, Love, Wow, Haha, Sad, Angry, Care, Shares, `Page Name`) %>% | |
filter(`Page Name` == "Jair Messias Bolsonaro") %>% | |
group_by(data_publ) %>% | |
summarise(interacoes = sum(Likes + Love + Wow + Haha + Sad + Angry + Care + Shares), posts=n()) %>% | |
mutate(tx = interacoes/posts) %>% | |
ggplot(aes(data_publ, tx, colour = "#c00")) + | |
geom_point() + | |
geom_smooth(colour = "#000000", fill = "#000000") | |
# media de interacoes por post, por dia | |
int_posts_fb <- d %>% | |
select(data_publ, Type, `Total Interactions`, Comments, Likes, Love, Wow, Haha, Sad, Angry, Care, Shares, `Page Name`) %>% | |
filter(`Page Name` == "Jair Messias Bolsonaro") %>% | |
group_by(data_publ) %>% | |
summarise(interacoes = sum(Likes + Love + Wow + Haha + Sad + Angry + Care + Shares), posts=n()) %>% | |
mutate(tx = interacoes/posts) %>% | |
mutate(ma = movavg(tx, 30, "e")) %>% | |
ggplot(aes(data_publ, ma, colour = "#c00")) + | |
geom_point() + | |
geom_smooth(method = "lm", colour = "#000000", fill = "#000000") | |
# TWITTER - media de interacoes por post, por dia | |
int_posts_tt <- e %>% | |
filter(screen_name == "jairbolsonaro" & dia >= "2018-01-01") %>% | |
mutate(ma = movavg(tx_engajamento, 30, "e")) %>% | |
ggplot(aes(dia, ma, colour = "#c00")) + | |
geom_point() + | |
geom_smooth(method = "lm", colour = "#000000", fill = "#000000") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment