set_variable_labels {metatools} | R Documentation |
Apply labels to a data frame using a metacore object
Description
This function leverages metadata available in a metacore object to apply labels to a data frame.
Usage
set_variable_labels(data, metacore, dataset_name = NULL)
Arguments
data |
A dataframe or tibble upon which labels will be applied |
metacore |
metacore object that contains the specifications for the dataset of interest. |
dataset_name |
Optional string to specify the dataset. This is only needed if the metacore object provided hasn't already been subsetted. |
Value
Dataframe with labels applied
Examples
mc <- metacore::spec_to_metacore(
metacore::metacore_example("p21_mock.xlsx"),
quiet=TRUE
)
dm <- haven::read_xpt(metatools_example("dm.xpt"))
set_variable_labels(dm, mc, dataset_name = "DM")
[Package metatools version 0.1.6 Index]