pnadc_design: Create PNADC survey object with its sample design

View source: R/pnadc_design.R

pnadc_designR Documentation

Create PNADC survey object with its sample design

Description

This function creates PNADC survey object with its sample design for analysis using survey package functions.

Usage

pnadc_design(data_pnadc)

Arguments

data_pnadc

A tibble of PNADC microdata read with read_pnadc function.

Value

An object of class survey.design or svyrep.design with the data from PNADC and its sample design.

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

get_pnadc for downloading, labeling, deflating and creating survey design object for PNADC microdata.
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_example for getting the path of the quarter PNADC toy example files.

Examples

# Using data read from disk
input_path <- pnadc_example(path="input_example.txt")
data_path <- pnadc_example(path="exampledata.txt")
dictionary.path <- pnadc_example(path="dictionaryexample.xls")
deflator.path <- pnadc_example(path="deflatorexample.xls")
pnadc.df <- read_pnadc(microdata=data_path, input_txt=input_path, vars=c("VD4001","VD4002"))
pnadc.df <- pnadc_labeller(data_pnadc=pnadc.df, dictionary.file=dictionary.path)
pnadc.df <- pnadc_deflator(data_pnadc=pnadc.df, deflator.file=deflator.path)

pnadc.svy <- pnadc_design(data_pnadc=pnadc.df)
# Calculating proportion of employed and unemployed people
if (!is.null(pnadc.svy)) survey::svymean(x=~VD4002, design=pnadc.svy, na.rm=TRUE)

# Downloading data
pnadc.df2 <- get_pnadc(year=2017, quarter=4, selected=FALSE, vars=c("VD4001","VD4002"),
                       defyear=2017, defperiod=4, labels=TRUE, deflator=TRUE, design=FALSE,
                       reload=TRUE, savedir=tempdir())
pnadc.svy2 <- pnadc_design(data_pnadc=pnadc.df2)
# Calculating proportion of employed and unemployed people
if (!is.null(pnadc.svy2)) survey::svymean(x=~VD4002, design=pnadc.svy2, na.rm=TRUE)

PNADcIBGE documentation built on Nov. 19, 2023, 1:09 a.m.