get_labels_enframed: Get the variable labels of a labelled tibble in an enframed...

View source: R/enframed_and_labelled.R

get_labels_enframedR Documentation

Get the variable labels of a ⁠labelled tibble⁠ in an ⁠enframed tibble⁠

Description

Given a data tibble/data.frame, this function will return a tibble in enframed format (two columns named name and value, see tibble::enframe() for details), where the name column contains the names of the variables in the original tibble and the value column contains the labels.

This can be used to review the labels, and could (if coupled with a set_labels_enframed() function, which is not currently implemented) be used to preserve labels across label-destructive operations, or export labels to a file (or a sheet in an excel file).

Finally, it could be used in conjunction with zmisc::lookup() and dplyr::rename_with() in a pipe to rename variables in order to replace the names of variables with their labels for display in a plot or table function that does not support the display of labels in a simple way.

Usage

get_labels_enframed(d)

Arguments

d

The tibble whose columns have variable labels.

Value

A tibble in enframed format containing variable names and labels.


torfason/zulutils documentation built on Aug. 21, 2023, 5:46 p.m.