get_variable_labels {rdhs}R Documentation

Get Survey Variable Labels

Description

Return variable labels from a dataset

Usage

get_variable_labels(dataset, return_all = TRUE)

Arguments

dataset

Can be either the file path to a dataset, the dataset as a 'data.frame' or the filenames of datasets. See details for more information

return_all

Logical whether to return all variables (TRUE) or only those with labels.

Details

Returns variable names and their labels from a dataset. You can pass for the 'data' argument any of the following:

Value

A data.frame consisting of the variable name and labels.

Examples

## Not run: 
# get the model datasets included with the package
model_datasets <- model_datasets

# download one of them
g <- get_datasets(dataset_filenames = model_datasets$FileName[1])

# we can pass the list of filepaths to the function
head(get_variable_labels(g))

# or we can pass the full dataset
r <- readRDS(g[[1]])
head(get_variable_labels(r))

## End(Not run)

[Package rdhs version 0.8.1 Index]