Socio economic data

Author

Raphael Saldanha

Last modification

December 1, 2023 | 09:07:18 +01:00

Packages

library(tidyverse)
library(janitor)
library(arrow)
source("../functions.R")

HDI

hdi <- read_delim(
  file = data_dir("socioeconomic_data/idhm.csv"),
  delim = ",", locale=locale(decimal_mark = "."), 
  na = "-",
  col_types = cols(
    CD_GEOCMU = col_character(),
    Município = col_character(),
    CodEstado = col_character(),
    Estado = col_character(),
    IDHM1991 = col_double(),
    IDHMR1991 = col_double(),
    IDHML1991 = col_double(),
    IDHME1991 = col_double(),
    R1991 = col_double(),
    IDHM2000 = col_double(),
    IDHMR2000 = col_double(),
    IDHML2000 = col_double(),
    IDHME2000 = col_double(),
    R2000 = col_double(),
    IDHM2010 = col_double(),
    IDHMR2010 = col_double(),
    IDHML2010 = col_double(),
    IDHME2010 = col_double(),
    R2010 = col_double(),
    NM_MUNNICIP = col_character()
  )
) %>%
  clean_names() %>%
  rename(code_muni = cd_geocmu, name_muni = municipio, code_uf = cod_estado, uf = estado) %>%
  select(-nm_munnicip) %>%
  mutate(code_muni = substr(code_muni, 0, 6))

Export

write_parquet(x = hdi, sink = data_dir("socioeconomic_data/hdi.parquet"))

Session info

sessionInfo()
R version 4.2.3 (2023-03-15)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /home/raphaelfs/miniconda3/envs/quarto/lib/libopenblasp-r0.3.23.so

locale:
 [1] LC_CTYPE=pt_BR.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=pt_BR.UTF-8        LC_COLLATE=pt_BR.UTF-8    
 [5] LC_MONETARY=pt_BR.UTF-8    LC_MESSAGES=pt_BR.UTF-8   
 [7] LC_PAPER=pt_BR.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=pt_BR.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] arrow_12.0.0    janitor_2.2.0   lubridate_1.9.2 forcats_1.0.0  
 [5] stringr_1.5.0   dplyr_1.1.2     purrr_1.0.1     readr_2.1.4    
 [9] tidyr_1.3.0     tibble_3.2.1    ggplot2_3.4.2   tidyverse_2.0.0

loaded via a namespace (and not attached):
 [1] compiler_4.2.3    pillar_1.9.0      tools_4.2.3       bit_4.0.5        
 [5] digest_0.6.31     timechange_0.2.0  jsonlite_1.8.5    evaluate_0.21    
 [9] lifecycle_1.0.3   gtable_0.3.3      pkgconfig_2.0.3   rlang_1.1.1      
[13] cli_3.6.1         rstudioapi_0.14   parallel_4.2.3    yaml_2.3.7       
[17] xfun_0.39         fastmap_1.1.1     withr_2.5.0       knitr_1.43       
[21] generics_0.1.3    vctrs_0.6.3       htmlwidgets_1.6.2 hms_1.1.3        
[25] bit64_4.0.5       grid_4.2.3        tidyselect_1.2.0  snakecase_0.11.0 
[29] glue_1.6.2        R6_2.5.1          fansi_1.0.4       vroom_1.6.3      
[33] rmarkdown_2.22    tzdb_0.4.0        magrittr_2.0.3    scales_1.2.1     
[37] htmltools_0.5.5   assertthat_0.2.1  colorspace_2.1-0  utf8_1.2.3       
[41] stringi_1.7.12    munsell_0.5.0     crayon_1.5.2     
Back to top