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(tesseract) | |
library(stringr) | |
library(tidyverse) | |
#link do arqtigo | |
#https://observatorio-politica-fiscal.ibre.fgv.br/politica-economica/outros/federacao-em-perspectiva-um-balanco-de-custos-e-beneficios-por-uf#_ftn1 | |
#faz o ocr da primeira imagem | |
text<- ocr("ma11.png") |
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
--- | |
title: "Contas Nacionais" | |
output: | |
flexdashboard::flex_dashboard: | |
theme: | |
bg: "#101010" | |
fg: "#ffda00" | |
primary: "#183eff" | |
base_font: | |
google: Prompt |
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(readxl) | |
arquivos <- list.files("data/") | |
arquivos<- paste0("data/",arquivos) | |
tabela_final<- | |
purrr::map_dfr(1:length(arquivos), function(i){ | |
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(jsonlite) | |
# load the httr package | |
library(httr) | |
#Você deve ter uma chave gerada de API. Para isso você precisa criar um usuário na página dados.gov.br usando o gov.br | |
my_key<- "<sua_chave_aqui>" | |
# Define the API endpoint and headers | |
url <- "https://dados.gov.br/dados/api/publico/conjuntos-dados" |
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(readxl) | |
library(geobr) | |
library(tidyverse) | |
library(sf) | |
library(spData) | |
library(ggrepel) | |
get_municipalies_data<- function(){ | |
# Load required libraries |
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
gera_tabela_ibge_municipios<- function(){ | |
# Load required libraries | |
library(httr) | |
library(jsonlite) | |
library(janitor) | |
library(tidyverse) | |
# API endpoint URL | |
api_url <- "https://apisidra.ibge.gov.br/values/t/4714/n6/all/v/all/p/all/d/v614%202" | |
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
calcula_valor_constante <- function(df_dados_hist, data_constante ){ | |
#Argumentos | |
#df_dados_hist: dataframe em que as duas primeiras colunas são formadas por uma data (Y-m-d) e um valor | |
#data_constante: data para gerar valor constante. Formato da data: Y-m-d | |
#Por enquanto as datas estão limitadas à da série temporal baixada do IPCA Total do portal de dados abertos do BACEN | |
#Essa série começa em 1992-01-01 | |
library(dplyr) | |
library(lubridate) |
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
#Faça download de um conjunto de tabelas do bolsa família referente a qualquer período a partir de janeiro de 2003 | |
base_address<- "http://transparencia.gov.br/download-de-dados/bolsa-familia-pagamentos/" | |
#Alterar as variáveis abaixo de acordo com o que se deseja | |
ano_ini<- 2018 | |
ano_fim<- 2018 | |
mes_ini<-1 | |
ult_mes_disp<- 2 |
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
#Script para geração dos mapas usados no artigo da revista medium indicada no link abaixo | |
#https://medium.com/@fernandobarbalho/mapas-contando-hist%C3%B3ria-o-pib-dos-munic%C3%ADpios-brasileiros-aebb82f06086?source=friends_link&sk=cfb19f1276b5b8aea5a65672fb897dc8 | |
library(readxl) | |
library(tidyr) | |
library(tidyverse) | |
library(viridis) | |
library(purrr) | |
#consumir os dados do ibge |
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(microdatasus) | |
library(tidyverse) | |
ano_inicio<- 2020 | |
ano_fim <- 2020 | |
mes_inicio<-12 | |
mes_fim<-12 | |
estado<- "GO" |
NewerOlder