-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05af38f
commit f192664
Showing
9 changed files
with
101 additions
and
19 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
Version: 0.3.1 | ||
Date: 2024-02-08 15:14:44 UTC | ||
SHA: 028ef793b00ac8f8551a2c051e2dc46c574fa73c | ||
Version: 0.3.2 | ||
Date: 2024-03-23 15:56:12 UTC | ||
SHA: 05af38fa8f5eb7aed083b789d0ef9aa35749a361 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Type: Package | ||
Package: censobr | ||
Title: Download Data from Brazil's Population Census | ||
Version: 0.3.1 | ||
Version: 0.3.2 | ||
Authors@R: | ||
c(person(given="Rafael H. M.", family="Pereira", | ||
email="[email protected]", | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
## R CMD check results | ||
|
||
── R CMD check results ──────────────────────────────────────────────────── censobr 0.3.1 ──── | ||
Duration: 1h 38m 26.4s | ||
── R CMD check results ────────────────────────────── censobr 0.3.9999999 ──── | ||
Duration: 5m 52.9s | ||
|
||
0 errors ✔ | 0 warnings ✔ | 0 notes ✔ | ||
|
||
|
||
* Minor changes | ||
* Moved {arrow} package from `Imports` to `Suggests` while the {arrow} team fixes their conflict with CRAN policies related to downloading binary software. [See here](https://github.com/apache/arrow/issues/39806). | ||
* New package contributors: | ||
* Diego Rabatone Oliveira | ||
* Neal Richardson | ||
* Moved {arrow} package back to `Imports` | ||
|
||
* New data set and files included in this version: | ||
* 2022 census | ||
* Preliminary aggregate results of census tracts |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
library(dplyr) | ||
library(data.table) | ||
library(arrow) | ||
|
||
df <- data.table::fread('C:/Users/user/Downloads/Agregados_preliminares_por_setores_censitarios_BR/Agregados_preliminares_por_setores_censitarios_BR.csv') | ||
head(df) | ||
|
||
|
||
# remove P from code tract | ||
df[, CD_SETOR := gsub("P","", CD_SETOR)] | ||
head(df) | ||
|
||
|
||
# make all columns as character | ||
df <- mutate(df, across(everything(), as.character)) | ||
|
||
names(df) <- toupper(names(df)) | ||
|
||
df2 <- dplyr::rename(df, | ||
code_tract = CD_SETOR, | ||
code_muni = CD_MUN, | ||
name_muni = NM_MUN, | ||
code_subdistrict = CD_SUBDIST, | ||
name_subdistrict = NM_SUBDIST, | ||
code_district = CD_DIST, | ||
name_district = NM_DIST, | ||
code_urban_concentration = CD_CONCURB, | ||
name_urban_concentration = NM_CONCURB, | ||
code_state = CD_UF, | ||
name_state = NM_UF, | ||
code_micro = CD_MICRO, | ||
name_micro = NM_MICRO, | ||
code_meso = CD_MESO, | ||
name_meso = NM_MESO, | ||
code_immediate = CD_RGI, | ||
name_immediate = NM_RGI, | ||
code_intermediate = CD_RGINT, | ||
name_intermediate = NM_RGINT, | ||
code_region = CD_REGIAO, | ||
name_region = NM_REGIAO, | ||
area_km2 = AREA_KM2 | ||
) | ||
head(df2) | ||
|
||
|
||
# save | ||
dir.create('./data/tracts/2022/', recursive = T) | ||
|
||
dest_file <- paste0('2022_tracts_Preliminares.parquet') | ||
arrow::write_parquet(df2, paste0('./data/tracts/2022/', dest_file)) | ||
|
||
arrow::write_parquet(df2, 'd2.parquet') | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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