Learn R Programming

sjmisc (version 2.5.0)

lbl_df: Create a labelled data frame

Description

This method wraps a local data frame and adds a lbl_df class attribute. Printing a lbl_df-data frame is comparable to printing tibble objects, but the class information in the output is replaced by the variable label.

Usage

lbl_df(x)

Arguments

x

A data frame.

Value

x, with lbl_df class-attribute.

Examples

Run this code
# NOT RUN {
data(efc)
library(dplyr)

efc %>%
  select(e15relat, e16sex, e17age) %>%
  slice(1:3) %>%
  lbl_df()

efc %>%
  select(e15relat, e16sex, e17age) %>%
  to_label() %>%
  set_label(c("Relationship", "Elder's gender", "Elder's age")) %>%
  lbl_df()

# }

Run the code above in your browser using DataLab