get_ind_multiwave: Get individual data for multiple waves

Description Usage Arguments Value Examples

View source: R/import_data.R

Description

Gets individual response data for multiple waves.

Usage

1
get_ind_multiwave(dir, waves, vars, long = TRUE)

Arguments

dir

The path to the directory containing the subfolders for each wave. This is named "stata13_se" when downloading from UKDS.

waves

A vector of whole numbers indicating the desired waves of Understanding Society data.

vars

A character vector containing the desired variables. Variables should appear in all specified waves. Variables should be specified without the "w_" prefix and "pidp" is included by default. If an empty vector is provided, all variables will be returned.

long

The format of the output. If TRUE, data is returned in "long" format with all variable "w_" prefixes removed and with a column to indicate the numerical wave of the data. Otherwise, data is returned in "wide" format with a column for each wave and variable.

Value

A tibble containing individual response data for the desired waves and variables.

Examples

1
2
3
4
5
## Not run: 
get_ind_multiwave(dir="path/to/directory", waves=c(4, 10), vars="envhabit1")
get_ind_multiwave(dir="path/to/directory", waves=c(4, 10), vars=c("envhabit1", "envhabit2"), long=FALSE)

## End(Not run)

ch-williamson/rundsoc documentation built on Dec. 19, 2021, 2:59 p.m.