This function downloads PNADC data and applies panel identification algorithms
Usage
load_pnadc(
save_to,
years,
quarters = 1:4,
panel = "advanced",
raw_data = FALSE,
deflator = TRUE,
defyear = NULL,
defperiod = NULL,
save_options = c(TRUE, TRUE),
vars = NULL
)Arguments
- save_to
A
characterwith the directory in which to save the downloaded files.- years
A
numericindicating for which years the data will be loaded, in the format YYYY. Can be any vector of numbers, such as 2010:2012.- quarters
The quarters within those years to be downloaded. Can be a numeric vector or a list of vectors, for different quarters per year.
- panel
A
characterchoosing the panel algorithm to apply ("none", "basic", or "advanced"). For details, checkvignette("BUILD_PNADC_PANEL")- raw_data
A
logicalsetting the return of raw (TRUE) or processed (FALSE) variables.- deflator
A logical passed to
get_pnadc. IfTRUE(the default), deflator variables supplied byPNADcIBGEare included in the downloaded microdata.- defyear
The deflator year passed to
get_pnadcfor annual microdata. This argument is ignored for quarterly downloads and is used only whendeflator = TRUE. Seeget_pnadcfor details.- defperiod
The deflator period passed to
get_pnadcfor annual per-topic microdata. This argument is ignored for quarterly downloads and is used only whendeflator = TRUE. Seeget_pnadcfor details.- save_options
A
logicalvector of length 2. Controls whether quarterly files are saved and in which format all files are saved. Panel files are always saved. There are four possible combinations:c(TRUE, TRUE): saves quarterly and panel files in.rdsformat. This is the default.c(TRUE, FALSE): saves quarterly and panel files in.parquetformat.c(FALSE, TRUE): does not save quarterly files; panel files are saved in.rdsformat.c(FALSE, FALSE): does not save quarterly files; panel files are saved in.parquetformat.
- vars
A
charactervector of additional variable names to be downloaded, following the same convention as thevarsparameter inget_pnadc. Each name must match a column in the PNADC microdata exactly as published by IBGE (e.g."VD4019","V2009").Note that
get_pnadcalways returns a set of structural columns regardless of this argument, these include survey design weights (V1027,V1028,V1028001,V1028200,posest,posest_sxi) and identifiers such asUF,Estrato,V1029,V1033,ID_DOMICILIO, totalling around 210 columns. Whendeflator = TRUE, deflator variables (Habitual,Efetivo) are also included. Thevarsargument adds on top of those columns; it does not restrict them. UseNULL(the default) to download all available microdata columns.Deflation support in this wrapper is provided by
PNADcIBGE. For the deflator methodology and the deflator files themselves, seepnadc_deflatorin that package.If
panelis not"none", any columns required by the panel identification algorithm that are missing fromvarswill be added automatically and awarningwill list the columns that were added. The required columns per algorithm are:"basic":UPA,V1008,V1014,V2007,V20082,V20081,V2008."advanced": all of the above, plusV2003.
Note that several of these (
UPA,V1008,V1014) are part of the structural columns always returned byget_pnadc, so in practice onlyV2007,V20082,V20081,V2008(andV2003for"advanced") are likely to be auto-added.