Skip to content

Instantly share code, notes, and snippets.

@sergiospagnuolo
Created February 4, 2021 17:00
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/bb04821154646e78ccb097ea4fc3bb4a to your computer and use it in GitHub Desktop.
Save sergiospagnuolo/bb04821154646e78ccb097ea4fc3bb4a to your computer and use it in GitHub Desktop.
análise rápida sob blogs e pequenos veículos no Atlas da Notícia
library(tidyverse)
library(newsatlasbr)
library(clipr)
atlas_signin(email = "dados@voltdata.info", password = "senhatokenaberto")
dados <- newsatlasbr::organizations_state(uf = "all")
desertos <- newsatlasbr::news_deserts()
desertos %>% filter(populacao < 10000) %>% count()
ativos <- dados %>% filter(ativo == 1)
# veículos por região
regioes <- ativos %>%
group_by(regiao) %>%
count()
# BLOGS por região
blogs <- ativos %>%
filter(eh_site_pago == 1 | num_funcionarios == '1 a 5 colaboradores' | num_funcionarios == 'Um colaborador (operação individual/blog)' | str_detect(nome_veiculo, "BLOG", negate = FALSE)) %>%
# group_by(regiao) %>%
count()
# combina as duas tabelas acima para comparar
write_clip(regioes %>%
inner_join(blogs, by = "regiao", suffix = c(" veiculos", " blogs") ) %>%
mutate(pct_blogs = round((`n blogs`/`n veiculos`)*100,1)))
s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment