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
    
  
  
    
  | allan <- readxl::read_excel("~/../Downloads/Dados 13F ARCE.xlsx") %>% | |
| janitor::clean_names() %>% | |
| mutate(no_periodo = no_periodo %>% | |
| str_remove_all(",(?=\\d{3})") %>% | |
| str_replace(",", ".") %>% | |
| as.numeric()) | |
| allan2 <- allan %>% | |
| select(1, 2, 6) %>% | |
| mutate(ano = str_extract(periodo, "\\d{4}"), | 
  
    
      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
    
  
  
    
  | #' Inclui dummies | |
| #' | |
| #' @param str input com formula | |
| #' | |
| #' @return string da formula | |
| #' @export | |
| #' | |
| #' @examples | |
| #' incluir_dummies("ac ~ factor(mes)") | |
| incluir_dummies <- function(str) { | 
  
    
      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
    
  
  
    
  | buscar_placa <- function(placa) { | |
| dormir <- sample(c(0, 1), 1, prob = c(0.2, 0.8)) | |
| if (dormir) { | |
| Sys.sleep(rnorm(1, mean = 5, sd = 0.3)) | |
| } | |
| resp <- httr::GET( | |
| glue::glue("https://apicarros.com/v1/consulta/{placa}/json") | 
  
    
      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
    
  
  
    
  | --- | |
| title: Mapa Pietro | |
| output: pdf_document | |
| --- | |
| # Mapa | |
| ```{r, include=FALSE} | |
| library(openxlsx) | |
| # library(descr) | 
  
    
      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(tidyverse) | |
| pibs <- RCEPAL::CEPAL_stat(2203) | |
| pibs %>% | |
| filter(str_detect(País_desc, "México|Brasil|Venezuela|Chile|Argentina|Colombia|Uruguay")) %>% | |
| ggplot(aes(Años_desc, valor, col = País_desc)) + | |
| geom_line() + | |
| scale_y_log10() | |
  
    
      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(tidyverse) | |
| pib <- ipeadatar::ipeadata("SCN10_PIBG10") | |
| pib_periodos <- pib %>% | |
| mutate(ano = lubridate::year(date), | |
| periodo = cut(ano, c(0, 1929, 1944, 1963, 1988, 2005, 2013, Inf), | |
| labels = c("Café com leite", "Vargas", | |
| "1945-1964", | |
| "Ditadura", "Nova república", | |
| "Auge PT", "Nova república"))) | |
| media_geom <- function(value) { | 
  
    
      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(pnadc) | |
| library(tidyverse) | |
| motos <- tibble::tibble( | |
| ano = 2012:2020, | |
| trimestre = rep(1, seq.along = 2012:2020) | |
| ) %>% | |
| mutate(dado = purrr::map2(ano, trimestre, ler_pnad)) %>% | |
| pull(dado) %>% | |
| map_df(I) | 
  
    
      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(pnadc) | |
| library(tidyverse) | |
| motos <- tibble::tibble( | |
| ano = 2012:2020, | |
| trimestre = rep(1, seq.along = 2012:2020) | |
| ) %>% | |
| mutate(dado = purrr::map2(ano, trimestre, ler_pnad)) %>% | |
| pull(dado) %>% | |
| map_df(I) | 
  
    
      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
    
  
  
    
  | wiod <- readxl::read_excel("WIOT2014_Nov16_ROW.xlsx", skip = 5) | |
| # wiod <- wiod %>% | |
| # rename(cod_setor = 1, setor_input = 2, pais_input = 3, id_linha = 4) #%>% | |
| # set_names(str_remove(names(wiod), "(?<=\\d)\\.{3}\\d+")) | |
| wiod_long <- wiod %>% | |
| rename(cod_setor_input = 1, setor_input = 2, pais_input = 3, id_linha = 4) %>% | |
| gather(id_col, valor, -(cod_setor_input:id_linha)) | 
  
    
      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
    
  
  
    
  | res <- RCEPAL::series_CEPAL() | |
| res %>% glimpse() | |
| res %>% | |
| filter(str_detect(nome_serie, "informal")) %>% | |
| as_tibble() %>% | |
| unique() | |
| informal1 <- RCEPAL::CEPAL_stat(252) | |
| informal1 %>% | 
NewerOlder