knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" ) library(ggplot2) library(dplyr)
O objetivo de folhar2 eh fazer raspar dados da Folha.
Para instalar do github, rode
remotes::install_github("tomasbarcellos/folhar2")
This is a basic example which shows you how to solve a common problem:
library(folhar2) inicio_mes <- Sys.Date() %>% lubridate::floor_date("month") %>% format(format = "%d/%m/%Y") busca <- folha_buscar("recessao", inicio_mes) busca
Quais as sesoes da folha que mais publicaram sobre recessao?
table(busca$secao)
Evolucao do uso do termo no mes
library(ggplot2) library(dplyr) busca %>% select(hora) %>% mutate(hora = stringr::str_remove(hora, "ยบ"), data = stringr::str_extract(hora, "\\d{1,2}\\.[a-z]{3}\\.\\d{4}"), data = as.Date(data, format = "%d.%b.%Y")) %>% count(data) %>% ggplot(aes(data, n)) + geom_line() + scale_y_continuous("Quantidade", limits = c(0, NA)) + ggtitle("Mencoes ao termo 'recessao' ao longo do mes")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.