Skip to content

Commit

Permalink
version 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rafapereirabr authored and cran-robot committed Jan 10, 2024
1 parent 94c6dd6 commit 58d3a87
Show file tree
Hide file tree
Showing 33 changed files with 764 additions and 249 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
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.2.0
Version: 0.3.0
Authors@R:
c(person(given="Rafael H. M.", family="Pereira",
email="rafa.pereira.br@gmail.com",
Expand Down Expand Up @@ -29,11 +29,11 @@ VignetteBuilder: knitr
Encoding: UTF-8
RoxygenNote: 7.2.3
NeedsCompilation: no
Packaged: 2023-09-30 19:52:33 UTC; user
Packaged: 2024-01-09 14:46:40 UTC; user
Author: Rafael H. M. Pereira [aut, cre]
(<https://orcid.org/0000-0003-2125-7465>),
Rogério J. Barbosa [aut] (<https://orcid.org/0000-0002-6796-4547>),
Ipea - Institute for Applied Economic Research [cph, fnd]
Maintainer: Rafael H. M. Pereira <rafa.pereira.br@gmail.com>
Repository: CRAN
Date/Publication: 2023-09-30 20:12:39 UTC
Date/Publication: 2024-01-09 15:20:06 UTC
62 changes: 32 additions & 30 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,69 +1,71 @@
e501c70a2ca31dab947fa334a44ed91d *DESCRIPTION
c36b6f37cf2aa526eda17b89208f6840 *DESCRIPTION
11b2243851ba384d31e621f2a9723256 *LICENSE
bb00d5b1ea3334728d7f4edd3e4059f8 *NAMESPACE
771012419c24bab80fa5d09ad47130de *NEWS.md
b1c779553f60812f2dbc346076b31a97 *NEWS.md
50ceedf9155831fdb61be13a3ddf635b *R/add_labels_emigration.R
147ff2b51428da402a1bfcb2dc672a25 *R/add_labels_families.R
924ee082323f6718913ba9c5b5c6d4df *R/add_labels_households.R
8f6ecbd7a36a79c209c57d6d540ea50a *R/add_labels_mortality.R
bfe9f25530e79d908a730036ff54e567 *R/add_labels_population.R
4f184a43d030cbd1bc69216ab1e3e5d1 *R/censobr.R
90db4293312fd8312dccba29d36a2e9f *R/censobr_cache.R
bf599e5ef98e6dc5bd164a5839381f57 *R/data_dictionary.R
ad7412a40acea813f957ddcf5ecfbe5f *R/docs_interview_manual.R
f27cb1189cf76346c0baf73056890db2 *R/docs_questionnaire.R
5335cb518b47c337741a6ebdb3e5ccd7 *R/onLoad.R
9a41fac7cbcb9e5e65c45b08d87712e9 *R/read_emigration.R
69d7d750b80d890cae8c98e1accb7f7a *R/read_families.R
2c310f7bd33266e90370c8a563b8a0cb *R/read_households.R
98fd5c2e16389a94bbd77e7463f78403 *R/read_mortality.R
cf5adf8dc0459227d475572550dd41d6 *R/read_population.R
14cc08f00642a7638f0a82cd067b7276 *R/read_tracts.R
6250af9c3c6ba62d5362f51065ef2e9a *R/data_dictionary.R
f6f8697b7bebb6e27454230dd5571f40 *R/docs_interview_manual.R
b750dc138208e86276ed20d2cdbb7bc8 *R/docs_questionnaire.R
5db447b39879a0b197003105bb519735 *R/onLoad.R
013f504ec4e1f9d2fbde6b3e279a9d86 *R/read_emigration.R
38e43fc88be617910f7aaad0f72fc4cb *R/read_families.R
1b9b299a16020d597e3e12a72287d530 *R/read_households.R
1eb8cbdd59de7d1da038c8a2136a656d *R/read_mortality.R
ef9a8b16c4e8bc538d70da6df4a8e45a *R/read_population.R
1c885f6aa3fbaa45187ec18c516ef1d2 *R/read_tracts.R
ae2c72d160b5ba04e7d46189fd245920 *R/set_censobr_cache_dir.R
8e65410a49a53bf3f71b65093e6e051d *R/utils.R
ec6e3a7757b40a7a81902edc34c396e2 *README.md
675361616e266343f825951deddd8190 *README.md
b83b0d0dfa6ea82d51880813fbebc0e9 *build/vignette.rds
1add3ea9fc68f2187ff497e0e726608b *inst/CITATION
9bd3244db54bd152a17e96d6a6d92235 *inst/doc/censobr.R
23980b4222b3b56f0f634966a35e72cf *inst/doc/censobr.Rmd
4d397fa70f43504cd8207dde6126ca55 *inst/doc/censobr.html
c0c3740d72056db3bb46a0a8b158df25 *inst/doc/census_tracts_data.R
cfaa611a8566c3e52f4b37c6335c0f59 *inst/doc/census_tracts_data.Rmd
5db2c7d78e73fa4f6cf4abcce85cb3d4 *inst/doc/census_tracts_data.html
be9f934b89ec11782d77624586c3acf0 *inst/doc/censobr.R
a7e96fb4b26d55a530e885ac6ac0ddd1 *inst/doc/censobr.Rmd
54db2f44de485d3de636d7c4db5a43ee *inst/doc/censobr.html
2a54857875632028158b03215526cd77 *inst/doc/census_tracts_data.R
1bb98a5280e03697d5d910096f20f0df *inst/doc/census_tracts_data.Rmd
cfee424034783233ac66d6c2f45bd069 *inst/doc/census_tracts_data.html
79f025df5dd3d9a4a9b475fcc73bf7b7 *inst/doc/documentation.R
c27e67ab9a915f2a262b19d60395462b *inst/doc/documentation.Rmd
15eaa899bd3b740ee74c198b0d71efd8 *inst/doc/documentation.html
5d281b34ed4d0d7943c9cbd906fb8057 *inst/doc/documentation.html
1b48e3117c78dc490ca54081b9231ef5 *man/cache_message.Rd
51d078d209ebdeac09c8f9be853256bd *man/censobr.Rd
42ebbbe9b8012060917497f933f0c280 *man/censobr_cache.Rd
fa57305420939827f7b08e7faf771173 *man/data_dictionary.Rd
787d37d3685ac3fea243259b6a7d7350 *man/data_dictionary.Rd
248aa9b96723be11c43ad41a71ed05c0 *man/download_file.Rd
b99bafee7c0cc94c8cf6b0f409bc3499 *man/figures/censobr_hexsticker.R
48219fca1ec818a8f49f1fd7b04efc68 *man/figures/ipea_logo.png
58bce978de1ff44ddff45c565fe6e4e2 *man/figures/logo.png
4b2af118a659294ac2cf09051d69970d *man/figures/person_icon.xcf
0122f64d230ba374dad15f0cf2f413f7 *man/figures/person_icon_white.png
b721bd549d8d9e07427113334b9f77f5 *man/interview_manual.Rd
c15cc92875dc74441d147a5c585d3be6 *man/questionnaire.Rd
b577b311f7026759738bb931aeeedfff *man/questionnaire.Rd
a855d8a046ff6692d8b36b41d83e13b0 *man/read_emigration.Rd
0656dbf86c8e47b216cbc684ec6c618e *man/read_families.Rd
2d7fba45b09378d3fc720a4beb8befdb *man/read_families.Rd
77fc7b46b57dfe79a62978bf3d977127 *man/read_households.Rd
38ecc42fd552db16c005b200e0815b9d *man/read_mortality.Rd
e5137234284092291506c676f41a4068 *man/read_population.Rd
e37e4cc4444631ddde66447c8821cb1f *man/read_tracts.Rd
436103e9586a70b63971f33c4be72619 *man/read_tracts.Rd
612385be109e4192883eb7f8aa849c87 *man/roxygen/templates/add_labels.R
d5d889932073de579e60949cd9f841d0 *man/roxygen/templates/as_data_frame.R
1eee990802cf2b626122a37d1807c6d0 *man/roxygen/templates/cache.R
ae2ba005e0f39daa9c2dc28b9818ce78 *man/roxygen/templates/columns.R
d4d9d9cd6cc072a6d02469509b649dd5 *man/roxygen/templates/showProgress.R
dfe018710e98911d4d0294c8af34f802 *man/roxygen/templates/year.R
adff8fcc69430033b7d0b72c08688156 *man/set_censobr_cache_dir.Rd
370770fecac6b547a80cc2c9007c3704 *tests/tests_rafa/merge_household.R
ad01582e1dcf61fdcc6aced8fb041fe2 *tests/tests_rafa/merge_pdfs.R
e1470eb4b1e5d8dab99db882f4452300 *tests/tests_rafa/survey.R
eb8a6410059183ee1810e7c52f9328f1 *tests/tests_rafa/test_rafa.R
71e5a807df34dd34e4ba852862b18771 *tests/testthat.R
629b09a768cbe392d888c360c55e2653 *tests/tests_rafa/test_rafa.R
dcd1fb174c42985502542d1fc24bde5a *tests/testthat.R
54897480c2acc432e286a384796cfbba *tests/testthat/test_data_dictionary.R
bd90535c465e9b6d25adc8bc1f81bf94 *tests/testthat/test_docs_interview_manual.R
cb593d5162a376f8e9b53f91a4a9b6e9 *tests/testthat/test_docs_questionnaire.R
d6b80f38605260e47f6f5acf993bd9a2 *tests/testthat/test_docs_interview_manual.R
7b1cb8c07cea20ee50906ddb2788bdc2 *tests/testthat/test_docs_questionnaire.R
cd6c09779ea978e67ddcd86ced7d4bf6 *tests/testthat/test_labels_emigration.R
6ec3662a4a95c4f94afe60b7b3b4b8fd *tests/testthat/test_labels_families.R
72a96831f3ca3cb7965757e876d42978 *tests/testthat/test_labels_households.R
Expand All @@ -77,6 +79,6 @@ cc3fd48ca85481d9d50a6371305f761e *tests/testthat/test_read_population.R
016205ea450e7d2cfa0ae2823fdd9349 *tests/testthat/test_read_tracts.R
d2035d14be886a18e3d67158ff99d8d1 *tests/testthat/test_set_censobr_cache_dir.R
f4bfe8d8fc843ece5dfdfc5ac17617cd *tests/testthat/test_z_censobr_cache.R
23980b4222b3b56f0f634966a35e72cf *vignettes/censobr.Rmd
cfaa611a8566c3e52f4b37c6335c0f59 *vignettes/census_tracts_data.Rmd
a7e96fb4b26d55a530e885ac6ac0ddd1 *vignettes/censobr.Rmd
1bb98a5280e03697d5d910096f20f0df *vignettes/census_tracts_data.Rmd
c27e67ab9a915f2a262b19d60395462b *vignettes/documentation.Rmd
21 changes: 20 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
# censobr v0.1.1999 dev
# censobr v0.3.0

* Major changes
* The `questionnaire()` function now accepts questionnaires of `type`: `"long"` or `"short"`.
* Updated census tract data following latest update by IBGE on Oct/2023. Closed [#38](https://github.com/ipeaGIT/censobr/issues/38). As a result, the package moved to data release v0.3.0.

* Minor changes
* Replaced `.onAttach` by `.onLoad` so that the package works with `censobr::function()`
* Fixed documentation of various functions.
* Fixed issue to make sure censobr uses suggested packages conditionally on CRAN
* Fixed message when user requests a data set / file for a year that is not available

* New data set and files included in this version:
* 2022 census [*New*]
* Questionnaires and interview manuals
* Short questionnaires for every census between 1960 and 2022.
* Long questionnaire for the 1960 and 2022 censuses.


# censobr v0.2.0

* Major changes
* New function `read_tracts()` to read Census tract-level aggregate data.
Expand Down
2 changes: 1 addition & 1 deletion R/data_dictionary.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#'
#' data_dictionary(year = 2010, dataset = 'tracts', showProgress = FALSE)

data_dictionary <- function(year = NULL,
data_dictionary <- function(year = 2010,
dataset = NULL,
showProgress = TRUE,
cache = TRUE){
Expand Down
6 changes: 3 additions & 3 deletions R/docs_interview_manual.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ interview_manual <- function(year = NULL,
checkmate::assert_numeric(year)

# data available for the years:
years <- c(1970, 1980, 1991, 2000, 2010)
years <- c(1970, 1980, 1991, 2000, 2010, 2022)
if (isFALSE(year %in% years)) { stop( paste0("Error: Interview manual currently only available for the years: ",
paste(years), collapse = " ")
)}
paste(years, collapse = " "))
) }

### Get url
fname <- paste0(year, '_interview_manual.pdf')
Expand Down
32 changes: 18 additions & 14 deletions R/docs_questionnaire.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#' censuses
#'
#' @template year
#' @param type Character. The type of questionnaire, whether the one used in the
#' sample component of the census, or on the universe component. Options
#' currently include `c("sample")`.
#' @param type Character. The type of questionnaire used in the survey, whether
#' the `"long"` one used in the sample component of the census, or the
#' `"short"` one, which is answered by more households. Options include
#' `c("long", "short")`.
#' @template showProgress
#' @template cache
#'
Expand All @@ -18,30 +19,33 @@
#' library(censobr)
#'
#' # Open questionnaire on browser
#' questionnaire(year = 2010, type = 'sample', showProgress = FALSE)
#' questionnaire(year = 2010, type = 'long', showProgress = FALSE)
#'
questionnaire <- function(year = NULL,
type = NULL,
showProgress = TRUE,
cache = TRUE){
# year = 2010
# type = 'sample'
questionnaire <- function(year = 2010,
type = NULL,
showProgress = TRUE,
cache = TRUE){
# year = 2000
# type = 'short'
# type = 'long'

### check inputs
checkmate::assert_numeric(year)
checkmate::assert_string(type)

# data available for the years:
years <- c(1970, 1980, 1991, 2000, 2010)
years <- c(1960, 1970, 1980, 1991, 2000, 2010, 2022)
if (isFALSE(year %in% years)) { stop( paste0("Error: Questionnaire currently only available for the years: ",
paste(years), collapse = " ")
paste(years, collapse = ", "))
)}

# data available for data sets:
data_sets <- c('sample')
data_sets <- c('long', 'short')
if (isFALSE(type %in% data_sets)) { stop( paste0("Error: Questionnaire currently only available for the types: ",
paste(data_sets, collapse = ", "))
)}
)}



### Get url
fname <- paste0(year, '_questionnaire_', type, '.pdf')
Expand Down
4 changes: 2 additions & 2 deletions R/onLoad.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# package global variables
censobr_env <- new.env(parent = emptyenv()) # nocov start

.onAttach <- function(libname, pkgname){
.onLoad <- function(libname, pkgname){

# data release
censobr_env$data_release <- 'v0.2.0'
censobr_env$data_release <- 'v0.3.0'

# local cache dir
cache_d <- paste0('censobr/data_release_', censobr_env$data_release)
Expand Down
12 changes: 6 additions & 6 deletions R/read_emigration.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
#'
#'
read_emigration <- function(year = 2010,
columns = NULL,
add_labels = NULL,
as_data_frame = FALSE,
showProgress = TRUE,
cache = TRUE){
columns = NULL,
add_labels = NULL,
as_data_frame = FALSE,
showProgress = TRUE,
cache = TRUE){

### check inputs
checkmate::assert_numeric(year)
Expand All @@ -42,7 +42,7 @@ read_emigration <- function(year = 2010,
# data available for the years:
years <- c(2010)
if (isFALSE(year %in% years)) { stop(paste0("Error: Data currently only available for the years ",
paste(years), collapse = " "))}
paste(years, collapse = " ")))}

### Get url
file_url <- paste0("https://github.com/ipeaGIT/censobr/releases/download/",
Expand Down
4 changes: 2 additions & 2 deletions R/read_families.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' Download microdata of family records from Brazil's census. Data collected in
#' the sample component of the questionnaire.
#'
#' @param year Numeric. Year of reference in the format `yyyymm`. Defaults to `2000`.
#' @param year Numeric. Year of reference in the format `yyyy`. Defaults to `2000`.
#' @template columns
#' @template add_labels
#' @template as_data_frame
Expand Down Expand Up @@ -36,7 +36,7 @@ read_families <- function(year = 2000,
# data available for the years:
years <- c(2000)
if (isFALSE(year %in% years)) { stop(paste0("Error: Data currently only available for the years ",
paste(years), collapse = " "))}
paste(years, collapse = " ")))}

### Get url
file_url <- paste0("https://github.com/ipeaGIT/censobr/releases/download/",
Expand Down
2 changes: 1 addition & 1 deletion R/read_households.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ read_households <- function(year = 2010,
# data available for the years:
years <- c(1970, 1980, 1991, 2000, 2010)
if (isFALSE(year %in% years)) { stop(paste0("Error: Data currently only available for the years ",
paste(years), collapse = " "))}
paste(years, collapse = " ")))}

### Get url
file_url <- paste0("https://github.com/ipeaGIT/censobr/releases/download/",
Expand Down
14 changes: 7 additions & 7 deletions R/read_mortality.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
#' # dplyr::glimpse(df)
#'
read_mortality <- function(year = 2010,
columns = NULL,
add_labels = NULL,
as_data_frame = FALSE,
showProgress = TRUE,
cache = TRUE){
columns = NULL,
add_labels = NULL,
as_data_frame = FALSE,
showProgress = TRUE,
cache = TRUE){

### check inputs
checkmate::assert_numeric(year)
Expand All @@ -46,12 +46,12 @@ read_mortality <- function(year = 2010,
# available for the years:
years <- c(2010)
if (isFALSE(year %in% years)) { stop(paste0("Error: Data currently only available for the years ",
paste(years), collapse = " "))
paste(years, collapse = " ")))
}

### Get url
file_url <- paste0("https://github.com/ipeaGIT/censobr/releases/download/",
censobr_env$data_release, "/", year, "_deaths_",
censobr_env$data_release, "/", year, "_mortality_",
censobr_env$data_release, ".parquet")


Expand Down
2 changes: 1 addition & 1 deletion R/read_population.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ read_population <- function(year = 2010,
# data available for the years:
years <- c(1970, 1980, 1991, 2000, 2010)
if (isFALSE(year %in% years)) { stop(paste0("Error: Data currently only available for the years ",
paste(years), collapse = " "))}
paste(years, collapse = " ")))}

### Get url
file_url <- paste0("https://github.com/ipeaGIT/censobr/releases/download/",
Expand Down
4 changes: 2 additions & 2 deletions R/read_tracts.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#'
#' @template year
#' @param dataset Character. The dataset to be opened. Options currently include
#' `c("Basico", "Domicilio", "DomicilioRenda", "Entorno", "ResponsavelRenda", "Responsavel", "PessoaRenda")`.
#' `c("Basico", "Domicilio", "DomicilioRenda", "Responsavel", "ResponsavelRenda", "Pessoa", "PessoaRenda", "Entorno")`.
#' @template as_data_frame
#' @template showProgress
#' @template cache
Expand Down Expand Up @@ -41,7 +41,7 @@ read_tracts <- function(year = 2010,
# data available for the years:
years <- c(2010)
if (isFALSE(year %in% years)) { stop(paste0("Error: Data currently only available for the years ",
paste(years), collapse = " "))}
paste(years, collapse = " ")))}

# data available for data sets:
data_sets <- c("Basico", "Domicilio", "DomicilioRenda", "Entorno",
Expand Down
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
coverage](https://codecov.io/gh/ipeaGIT/censobr/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ipeaGIT/censobr?branch=main)
[![Lifecycle:
maturing](https://img.shields.io/badge/lifecycle-maturing-yellow.svg)](https://lifecycle.r-lib.org/articles/stages.html)

[![R-CMD-check-main](https://github.com/ipeaGIT/censobr/workflows/R-CMD-check-main/badge.svg)](https://github.com/ipeaGIT/censobr/actions)
[![R-CMD-check-dev](https://github.com/ipeaGIT/censobr/workflows/R-CMD-check-dev/badge.svg)](https://github.com/ipeaGIT/censobr/actions)

[![R-CMD-check](https://github.com/ipeaGIT/censobr/actions/workflows/R-CMD-check.yaml/badge.svg?branch=main)](https://github.com/ipeaGIT/censobr/actions?query=branch%3Amain)

**censobr** is an R package to download data from Brazil's Population Census. The package is built on top of the [Arrow platform](https://arrow.apache.org/docs/r/), which allows users to work with larger-than-memory census data using [{dplyr} familiar functions](https://arrow.apache.org/docs/r/articles/arrow.html#analyzing-arrow-data-with-dplyr).

Expand Down Expand Up @@ -118,10 +115,7 @@ bibentry(
)
```
::: {.pkgdown-devel}
tests only on dev branch
`2+2`
:::




0 comments on commit 58d3a87

Please sign in to comment.