censobr v1.0.0
CRAN release: 2026-09-21
-
New data release v1.0.0, which includes the following news files or edits:
- Census 2022. Closes #65
- Data dictionary of microdata
- Public microdata.
- New function
import_microdata22(), which brings the controlled-access microdata of the 2022 Population Census into censobr. See new features below.
- Data fixes
- 2022: census tract, table “preliminares”
- 2010: census tract, table “pessoas”, state of Sao Paulo
- 1980: code_muni values of Tocantins and Fernando de Noronha
- 1970: variables
weight_householdandhh_incomeare stored as integers. Totals weighted byweight_householdtherefore differ slightly from earlier releases –sum(weight_household)goes from 17,682,112 to 17,643,387 (-0.22%). - Major updates. See details in v1.0.0.
- All year: the codes of categorical variables of the microdata are stored as integers rather than text, in every census year. Code that filtered on the text form needs to drop the quotes, e.g.
filter(V0601 == "1")becomesfilter(V0601 == 1). Zero-padded codes lose the padding as well:V0402 == "01"becomesV0402 == 1. Values that used to be recorded as"."are nowNA.
- Census 2022. Closes #65
-
New features
- New function
import_microdata22()to import to censobr the controlled-access microdata of 2022. Once the.zipfile with the original data is importedread_(year = 2022)functions always read the controlled-access microdata. If the controlled-access microdata have not been imported yet, these functions return an informative warning and download the public microdata set, which has fewer variables. See the new vignette Working with 2022 microdata. Closes #79.
- New function
-
Major changes
-
add_labels = "pt"now works for all years and tables since 1960. Closes #25, #26, and #27. -
merge_householdsparameter now works for all census years since 1960. Because merging all ~300 population + househols columns can require more than 20GB of memory,read_population(merge_households = TRUE)requirescolumnsto be set – naming the columns you need keeps the operation to a few seconds and a few dozen MB. Closes #31. -
data_dictionary()now takes only two values indataset:"microdata", which opens a single Excel file covering every variable of the microdata and is now available for all censuses since 1960, and"tracts", available since 1970. - Microdata dictionary now includes in a single file all supplementary dictionaries of variable codes (e.g. occupation, religion, education categories etc). Closes 53.
-
-
Breaking changes
- All functions that take a
yearnow require the user to declare it. Previouslyquestionnaire()silently assumedyear = 2010. - The arguments
questionnaire(type),read_tracts(dataset)anddata_dictionary(dataset)are now explicitly required, and the error message lists the values accepted. -
data_dictionary()now takes only two values indataset:"microdata", which opens a single Excel file covering every variable of the microdata. The per-data-set dictionaries opened withdataset = "population"anddataset = "households"were retired, since the microdata dictionary now covers the pre-2000 censuses too.
- All functions that take a
-
Minor changes
- censobr now uses {httr2} to download files, replacing {curl}.
-
data_dictionary(),questionnaire()andinterview_manual()now return the path to the downloaded file. The file is only opened whenverbose = TRUEand the session is interactive, so scripted runs no longer launch a viewer. -
columnsnow only accepts a character vector of column names, in all five microdata readers (read_population(),read_households(),read_families(),read_mortality(),read_emigration()), matching its documented type. It previously also silently accepted numeric column indices. - The argument
datasetindata_dictionary()is also case insensitive now, as inread_tracts().
-
bug fixes
- Several bug fixes and a few label corrections when
add_labels = "pt"in multiple read_ functions. -
add_labels = "pt"now compares the codes of every census year as numbers, matching how the microdata are stored since the v0.7.0 data release. - Requesting a column that does not exist now returns an informative error naming the column, instead of an internal {dplyr} message.
- Passing more than one
yearnow returns an informative error. Previously a vector such asyear = c(2000, 2010)failed with a cryptic “the condition has length > 1” message from base R. - An incomplete download is now detected by comparing the size of the file with the size reported by the server, and is removed instead of being cached.
- A corrupted file in the local cache no longer throws an error. The file is removed and the function returns
NULL, so that running it again downloads a fresh copy instead of failing on every call. - Passing
cache = FALSEno longer fails when the cache directory does not exist yet, for example on a fresh installation. - Download error messages now match their cause. A failed transfer no longer reports the local file as corrupted, and an incomplete download no longer reports the internet connection as faulty.
- The temporary DuckDB database file created by
merge_households = TRUEis now removed when the merge finishes. Previously it was left behind in the session’s temp directory. - Data cached from previous data releases is deleted again. The cache directory is versioned by data release, so a new release leaves the files of the previous one behind. censobr used to delete them when the package was loaded, but that stopped working in v0.6.0, when the cache directory became a setting the user can change. The check now runs once per session, the first time data is downloaded, and can also be run on demand with
censobr_cache(delete_file = 'old'). Setoptions(censobr.keep_old_cache = TRUE)to keep those files, for example to go on working with an older data release. Microdata imported withimport_microdata22()are never deleted, because censobr cannot download them again.
- Several bug fixes and a few label corrections when
censobr v0.6.0
CRAN release: 2026-07-29
- Minor changes
- The function
data_dictionary()now does not open the file whenverbose = FALSE. Closes 72 - All data, documentation files and pipeline to generate the data sets shared through the censobr package have been migrated repository to https://github.com/ipea/censobr_prep_data.
- The function
- Data fixes included in this version:
- New data set and files included in this version:
- Data dictionary of microdata now includes a single Excel file with info for all variables, including auxiliary documentation. For now, available for the years 2000 and 2010.
censobr v0.5.0
CRAN release: 2025-07-07
- Major changes
- New function
get_censobr_cache_dir() - The function
set_censobr_cache_dir()now sets cache directories that persist across R sessions. Closes #55. The data is saved in versioned directory inside the cache directory. - The
yearparameter no longer defaults to2010. - New parameter
verbose(logical) indicating whether functions should print messsages
- New function
- Minor changes
- Improved internal code of
merge_households = TRUEto avoid duplicated columns - Improved package info and error messages with {cli}
- {censobr} now imports {cli} and {rlang}
- Improved internal code of
- New data set and files included in this version:
- 2022 census. Closes #64
- Census-tract level data
- Census-tract level data dictionary
- 2000 census. Closes #43
- Census-tract level data
- All data sets are save in
.parquetcompressed usingcompression='zstd'andcompression_level = 22. This has almost halved the size of data files, making downloads much more efficient at minimal cost of reading time. - All data sets are now sorted by key columns to speed up join operations. Closes #60.
- Fixed annoying message about arrow metadata. closed #56.
- 2022 census. Closes #64
censobr v0.4.1
CRAN release: 2025-02-28
- Minor changes
- Removed {duckplyr} from package dependency
- bug fixes
- Passing parameter
merge_households = TRUEnow returns the expected result.
- Passing parameter
censobr v0.4.0
CRAN release: 2024-09-20
- Major changes
- Some functions (
read_mortality,read_emigration) now include a new parametermerge_households(logical) to indicate whether the function should merge household variables to the output data. Partially closes #31 - {censobr} now imports the {duckplyr} package, which is used for merging household data. Closes issue #31.
- New vignette showing how to work with larger-than-memory data. Closes #42. The vignette still needs to be expanded with more examples, though.
- Some functions (
- Minor changes
- Updated Vignettes Closes issue #51
- Removed dependency on the {httr} package
- Now using
curl::multi_download()to download files in parallel. This brings the advantage that the package now automatically detects whether the data/documentation file has been updated and should be downloaded again.
- Changes to data sets and files included in this version:
- New data set and files included in this version:
censobr v0.3.2
CRAN release: 2024-03-23
- Minor changes
- Moved {arrow} package back to
Imports
- Moved {arrow} package back to
- New data set and files included in this version:
- 2022 census
- Preliminary aggregate results of census tracts
- 2022 census
censobr v0.3.1
CRAN release: 2024-02-23
- Minor changes
- Moved {arrow} package from
ImportstoSuggestswhile the {arrow} team fixes their conflict with CRAN policies related to downloading binary software. See here.
- Moved {arrow} package from
- New package contributors:
- Diego Rabatone Oliveira
- Neal Richardson
censobr v0.3.0
CRAN release: 2024-01-09
- Major changes
- The
questionnaire()function now accepts questionnaires oftype:"long"or"short". - Updated census tract data following latest update by IBGE on Oct/2023. Closed #38. As a result, the package moved to data release v0.3.0.
- The
- Minor changes
- Replaced
.onAttachby.onLoadso that the package works withcensobr::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
- Replaced
- 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.
- 2022 census [New]
censobr v0.2.0
CRAN release: 2023-09-30
- Major changes
- New function
read_tracts()to read Census tract-level aggregate data. - New function
data_dictionary()opens on a browser the data dictionary of Brazil’s census data. - New function
questionnaire()opens on a browser the questionnaire used in the data collection of Brazil’s censuses. - New function
interview_manual()opens on a browser the interview manual of the data collection of Brazil’s censuses.- New function
set_censobr_cache_dir()that allows users to set custom directory for caching files from the censobr package.
- New function
- New data sets of 1970, 1980 and 1991 censuses: microdata of population and households PLUS Census tract-level aggregate data for 2010. Closes #6, #7, #8 and 1#8
- New vignette on Census tract-level aggregate data for 2010.
- New vignette covering functions about census documentation and dictionary of variables. Closes #2.
- New function
- Minor changes
- Running
censobr_cache(delete_file = 'all')now removes all data and directories related from censobr. - censobr now uses suggested package {geobr} conditionally
- Running
- Data included in this version:
- 1970 census [New]
- Microdata of population, households
- 1980 census [New]
- Microdata of population, households
- 1991 census [New]
- Microdata of population, households
- 2000 Census
- Microdata of population, households and families.
- 2010 Census
- Microdata of population, households, deaths and emigration.
- Census tract-level aggregate data [New]
- 1970 census [New]
censobr v0.1.1
CRAN release: 2023-09-11
- Minor changes
- Changes requested by CRAN team
- Changed location of cached data to directory inside tools::R_user_dir(“censobr”, which = “cache”).
- The package now automatically deletes cached data from previous data releases that might exist from previous versions of the package
- Clean cache after intro vignette and testhat checks
censobr v0.1.0
CRAN release: 2023-09-06
- Launch of censobr v0.1.0 on CRAN https://cran.r-project.org/package=censobr
- All data sets are now enriched with geography columns following {geobr} name standards. This should help data manipulation and integration with spatial data from the {geobr} package. The added columns are: c(‘code_muni’, ‘code_state’, ‘abbrev_state’, ‘name_state’, ‘code_region’, ‘name_region’, ‘code_weighting’). Closes #5.
- Data included in this version:
- 2000 Census
- Microdata of population, households and families.
- 2010 Census
- Microdata of population, households, deaths and emigration.
- 2000 Census
