get_pnadc {PNADcIBGE} | R Documentation |
Download, label, deflate and create survey design object for PNADC microdata
Description
Core function of package. With this function only, the user can download a PNADC microdata from a year or quarter and get a sample design object ready to use with survey
package functions.
Usage
get_pnadc(
year,
quarter = NULL,
interview = NULL,
topic = NULL,
selected = FALSE,
vars = NULL,
defyear = NULL,
defperiod = NULL,
labels = TRUE,
deflator = TRUE,
design = TRUE,
reload = TRUE,
curlopts = list(),
savedir = tempdir()
)
Arguments
year |
The year of the data to be downloaded. Must be a number between 2012 and current year. Vector not accepted. |
quarter |
The quarter of the year of the data to be downloaded. Must be number from 1 to 4. Vector not accepted. If |
interview |
The interview number of the data to be downloaded. Must be number from 1 to 5. Vector not accepted. Using this option will get annual per interview data. If |
topic |
The quarter related to the topic of the data to be downloaded. Must be number from 1 to 4. Vector not accepted. Using this option will get annual per topic data. If |
selected |
Logical value. If |
vars |
Vector of variable names to be kept for analysis. Default is to keep all variables. |
defyear |
The year of the deflator data to be downloaded for annual microdata. Must be a number between 2017 and the last available year. Vector not accepted. If |
defperiod |
The quarter period of the deflator data to be downloaded for annual per topic microdata. Must be number from 1 to 4. Vector not accepted. If |
labels |
Logical value. If |
deflator |
Logical value. If |
design |
Logical value. If |
reload |
Logical value. If |
curlopts |
A named list object identifying the curl options for the handle when using functions from |
savedir |
Directory to save the downloaded data. Default is to use a temporary directory. |
Value
An object of class survey.design
or svyrep.design
with the data from PNADC and its sample design, or a tibble with selected variables of the microdata, including the necessary survey design ones.
Note
For more information, visit the survey official website <https://www.ibge.gov.br/estatisticas/sociais/trabalho/9171-pesquisa-nacional-por-amostra-de-domicilios-continua-mensal.html?=&t=o-que-e> and consult the other functions of this package, described below.
See Also
read_pnadc for reading PNADC microdata.
pnadc_labeller for labeling categorical variables from PNADC microdata.
pnadc_deflator for adding deflator variables to PNADC microdata.
pnadc_design for creating PNADC survey design object.
pnadc_example for getting the path of the quarter PNADC toy example files.
Examples
pnadc.svy <- get_pnadc(year=2017, quarter=4, selected=FALSE, vars=c("VD4001","VD4002"),
defyear=2017, defperiod=4, labels=TRUE, deflator=TRUE, design=TRUE,
reload=TRUE, curlopts=list(), savedir=tempdir())
# Calculating proportion of employed and unemployed people
if (!is.null(pnadc.svy)) survey::svymean(x=~VD4002, design=pnadc.svy, na.rm=TRUE)
pnadc.svy2 <- get_pnadc(year=2017, interview=5, selected=FALSE, vars=c("V4112","V4121B"),
defyear=2017, defperiod=4, labels=TRUE, deflator=TRUE, design=TRUE,
reload=TRUE, curlopts=list(), savedir=tempdir())
# Calculating average hours dedicated to the care of people or household chores
if (!is.null(pnadc.svy2)) survey::svymean(x=~V4121B, design=pnadc.svy2, na.rm=TRUE)
pnadc.svy3 <- get_pnadc(year=2017, topic=4, selected=FALSE, vars=c("S07006","S07007"),
defyear=2017, defperiod=4, labels=TRUE, deflator=TRUE, design=TRUE,
reload=TRUE, curlopts=list(), savedir=tempdir())
# Calculating proportion of cell phone for personal use with internet access
if (!is.null(pnadc.svy3)) survey::svymean(x=~S07007, design=pnadc.svy3, na.rm=TRUE)