Learn R Programming

PNSIBGE (version 0.2.1)

pns_deflator: Add deflator variables to PNS microdata

Description

This function adds deflator variables to PNS microdata. For deflation of income variables, the documentation provided through the following address must be used: https://ftp.ibge.gov.br/PNS/Documentacao_Geral/PNSIBGE_Deflator.pdf.

Usage

pns_deflator(data_pns, deflator.file)

Value

A tibble with the data provided from PNS survey and the deflator variables added for use.

Arguments

data_pns

A tibble of PNS microdata read with read_pns function.

deflator.file

The deflator file for selected survey available on official website: (select the deflator zip file) - https://ftp.ibge.gov.br/PNS/Documentacao_Geral/.

See Also

get_pns for downloading, labeling, deflating and creating survey design object for PNS microdata.
read_pns for reading PNS microdata.
pns_labeller for labeling categorical variables from PNS microdata.
pns_design for creating PNS survey design object.
pns_example for getting the path of the PNS toy example files.

Examples

Run this code
# Using data read from disk
input_path <- pns_example(path="input_example.txt")
data_path <- pns_example(path="exampledata.txt")
dictionary.path <- pns_example(path="dictionaryexample.xls")
deflator.path <- pns_example(path="deflatorexample.xls")
pns.df <- read_pns(microdata=data_path, input_txt=input_path, vars=c("J007","J009"))
pns.df <- pns_labeller(data_pns=pns.df, dictionary.file=dictionary.path)
pns.df <- pns_deflator(data_pns=pns.df, deflator.file=deflator.path)
# \donttest{
# Downloading data
pns.df2 <- get_pns(year=2019, selected=FALSE, anthropometry=FALSE, vars=c("J007","J009"),
                       labels=TRUE, deflator=FALSE, design=FALSE,
                       reload=TRUE, curlopts=list(), savedir=tempdir())
deflator.path2 <- pns_example(path="deflatorexample.xls")
pns.df2 <- pns_deflator(data_pns=pns.df2, deflator.file=deflator.path2)# }

Run the code above in your browser using DataLab