Created
December 27, 2021 18:59
-
-
Save cndesantana/cbdbf0497871c1d58233d68d6fc029fb to your computer and use it in GitHub Desktop.
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(httr) | |
| library(rvest) | |
| library(lubridate) | |
| library(tidyverse) | |
| getCompromissos <- function(url){ | |
| web = GET(url) | |
| compromissos = web %>% | |
| read_html() %>% | |
| html_nodes("div.item-compromisso") %>% | |
| html_text() | |
| return(compromissos) | |
| } | |
| df = data.frame(date = c(),url=c(),comp=c()) | |
| alldates = seq.Date(from=ymd("2019-01-01"),to=ymd("2021-12-27"),by = "1 day") | |
| for(i in 1:length(alldates)){ | |
| date_ = alldates[i] | |
| print(date_) | |
| url = paste0("https://www.gov.br/planalto/pt-br/acompanhe-o-planalto/agenda-do-presidente-da-republica/",date_) | |
| #print(url) | |
| comp = getCompromissos(url) | |
| if(length(comp) == 0){comp=NA} | |
| df = df %>% rbind(data.frame(date_,url,comp)) | |
| } | |
| saveRDS(df, file="agenda_bozo.rds") | |
| png("agenda.png",width=3200,height=1800,res=300) | |
| df %>% | |
| filter(!is.na(comp)) %>% | |
| count(date_) %>% | |
| ggplot(aes(x = date_, y = n)) + | |
| geom_bar(stat="identity") | |
| dev.off() | |
| df %>% | |
| mutate(ano = year(date_)) %>% | |
| filter(is.na(comp)) %>% | |
| count(ano) | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Até a data de hoje, 27/12/2021, na agenda do glorioso presidente da república do Brasil, Bozo, constam 92 dias sem atividade em 2021. Foram 97 dias sem atividade oficial em 2020. São 226 dias sem atividade desde o início do mandato, equivalente a 20%. Em outras palavras, para cada 10 meses de atividades registradas, o presidente tem 2 meses sem atividades. A mamata acabou (de começar)