get_covid {COVIDIBGE}R Documentation

Download, label, deflate and create survey design object for PNAD COVID19 microdata

Description

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

Usage

get_covid(
  year,
  month,
  vars = 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 equal to 2020. Vector not accepted.

month

The month of the year of the data to be downloaded. Must be number from 5 to 11. Vector not accepted.

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.

reload

Logical value. If TRUE, will re-download the files even if they already exist in the save directory. If FALSE, will be checked if the files already exist in the save directory and the download will not be performed repeatedly, be careful with coinciding names of microdata files.

curlopts

A named list object identifying the curl options for the handle when using functions from RCurl package.

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 PNAD COVID19 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/investigacoes-experimentais/estatisticas-experimentais/27946-divulgacao-semanal-pnadcovid1?t=o-que-e> and consult the other functions of this package, described below.

See Also

read_covid for reading PNAD COVID19 microdata.
covid_labeller for labeling categorical variables from PNAD COVID19 microdata.
covid_deflator for adding deflator variables to PNAD COVID19 microdata.
covid_design for creating PNAD COVID19 survey design object.
covid_example for getting the path of the PNAD COVID19 toy example files.

Examples


covid.svy <- get_covid(year=2020, month=5, vars=c("C001","C002"),
                       labels=TRUE, deflator=TRUE, design=TRUE,
                       reload=TRUE, curlopts=list(), savedir=tempdir())
# Calculating proportion of people temporarily away from work
if (!is.null(covid.svy)) survey::svymean(x=~C002, design=covid.svy, na.rm=TRUE)

[Package COVIDIBGE version 0.2.2 Index]