get_pof: Download, label, deflate and create survey design object for...

View source: R/get_pof.R

get_pofR Documentation

Download, label, deflate and create survey design object for POF microdata

Description

Core function of package. With this function only, the user can download a POF microdata from a year and get a sample design object ready to use with survey package functions.

Usage

get_pof(
  year,
  selected = FALSE,
  anthropometry = FALSE,
  vars = NULL,
  labels = TRUE,
  deflator = TRUE,
  design = TRUE,
  savedir = tempdir()
)

Arguments

year

The year of the data to be downloaded. Must be a number equal to 2008 or 2017. Vector not accepted.

selected

Logical value. If TRUE, the specific questionnaire for selected resident will be used. If FALSE, the basic questionnaire for household and residents will be used.

anthropometry

Logical value. If TRUE, the specific questionnaire for the anthropometry module of the selected resident will be used. If FALSE, the questionnaire defined by the argument selected of this function will be used. This argument will be used only if year is equal to 2017.

vars

Vector of variable names to be kept for analysis. Default is to keep all variables.

labels

Logical value. If TRUE, categorical variables will presented as factors with labels corresponding to the survey's dictionary.

deflator

Logical value. If TRUE, deflator variables will be available for use in the microdata.

design

Logical value. If TRUE, will return an object of class survey.design or svyrep.design. It is strongly recommended to keep this parameter as TRUE for further analysis. If FALSE, only the microdata will be returned.

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 POF 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/9050-pesquisa-de-orcamentos-familiares.html?=&t=o-que-e> and consult the other functions of this package, described below.

See Also

read_pof for reading POF microdata.
pof_labeller for labeling categorical variables from POF microdata.
pof_deflator for adding deflator variables to POF microdata.
pof_design for creating POF survey design object.
pof_example for getting the path of the POF toy example files.

Examples


pof.svy <- get_pof(year=2017, selected=FALSE, anthropometry=FALSE, vars=c("V0407","V0408"),
                       labels=TRUE, deflator=TRUE, design=TRUE, savedir=tempdir())
# Calculating proportion of people's purchase of goods or services
if (!is.null(pof.svy)) survey::svymean(x=~V0408, design=pof.svy, na.rm=TRUE)
pof.svy2 <- get_pof(year=2017, selected=TRUE, anthropometry=FALSE, vars=c("V4104","V4105"),
                       labels=TRUE, deflator=TRUE, design=TRUE, savedir=tempdir())
# Calculating proportion of reasons for non-routine trips indicated by people
if (!is.null(pof.svy2)) survey::svymean(x=~V4104, design=pof.svy2, na.rm=TRUE)
pof.svy3 <- get_pof(year=2017, selected=FALSE, anthropometry=TRUE, vars=c("V7102","V7104"),
                       labels=TRUE, deflator=TRUE, design=TRUE, savedir=tempdir())
# Calculating proportion of people who followed some type of diet
if (!is.null(pof.svy3)) survey::svymean(x=~V7104, design=pof.svy3, na.rm=TRUE)

POFIBGE documentation built on March 25, 2022, 1:05 a.m.