pns_labeller: Label categorical variables from PNS microdata

Description Usage Arguments Value Note See Also Examples

View source: R/pns_labeller.R

Description

This function labels categorical variables from PNS microdata.

Usage

1
pns_labeller(data_pns, dictionary.file)

Arguments

data_pns

A tibble of PNS microdata read with read_pns function.

dictionary.file

The dictionary file for selected survey available on official website: (select the dictionary and input zip file, according to the appropriated year, microdata folder and then, inside, documentation) - https://ftp.ibge.gov.br/PNS/.

Value

A tibble with the data provided from PNS survey and its categorical variables as factors with related labels.

Note

For more information, visit the survey official website <https://www.ibge.gov.br/estatisticas/sociais/saude/9160-pesquisa-nacional-de-saude.html?=&t=o-que-e> and consult the other functions of this package, described below.

See Also

get_pns for downloading, labelling, deflating and creating survey design object for PNS microdata.
read_pns for reading PNS microdata.
pns_deflator for adding deflator variable to PNS microdata.
pns_design for creating PNS survey design object.
pns_example for getting the path of the PNS example files.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# 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")
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)

# Downloading data
pns.df2 <- get_pns(year=2019, selected=FALSE, anthropometry=FALSE, vars=c("J007","J009"),
                       labels=FALSE, deflator=FALSE, design=FALSE, savedir=tempdir())
dictionary.path2 <- pns_example(path="dictionaryexample.xls")
pns.df2 <- pns_labeller(data_pns=pns.df2, dictionary.file=dictionary.path2)

PNSIBGE documentation built on Oct. 16, 2021, 1:07 a.m.