Skip to contents

This function makes it easy to get the variable labels from either an individual vector or a data frame. NOTE: it is not possible to set or modify the variable labels with this function.

Usage

attr_var_label(x, data, unlist)

Arguments

x

A vector object, the name of a column in a data.frame, or an an actual data.frame object.

data

A data.frame or tibble object. This should only be specified when x is only the name of a column in a data.frame.

unlist

Logical. If TRUE, the default, returns a named vector. If FALSE, returns a list. This only works when x is a data.frame