Skip to contents

Internal. This function will label pre-defined variables in a data.frame by adding a label attribute to the column. This can be used for one or multiple variables at the same time.

Usage

label_variables(x, labels)

Arguments

x

a data.frame or a tibble, with at least one column

labels

A named list with variable names in x as list names and the labels as list values. Values set to NULL remove the label.

Value

The function returns the original object with an additional "label" attribute on each provided variable.

Details

If used several times, the previous label is removed silently. Only accepts known variables from the provided data.frame.