skim_with_labels_and_levels: Skim a dataframe and include labels and levels

View source: R/helper_text_skim_with_labels_and_levels.R

skim_with_labels_and_levelsR Documentation

Skim a dataframe and include labels and levels

Description

This function takes a data.frame and returns a skim summary with variable names, labels, and levels for categorical variables. It is a wrapper around the skimr::skim() function.

Usage

skim_with_labels_and_levels(data)

Arguments

data

A data.frame to be skimmed

Value

A data.frame with variable names, labels, levels, and a skim summary

See Also

Other text_helpers: df_to_string(), vector_list_to_string()

Examples

if (requireNamespace("skimr", quietly = TRUE)) {
  # First add some labels to 'mtcars':
  mtcars$car <- rownames(mtcars)
  mtcars$car <- factor(mtcars$car, levels = rownames(mtcars))
  attr(mtcars$car, "label") <- "Name of the car"

  # Then skim the data:
  mtcars |>
    skim_with_labels_and_levels()
}

tidyprompt documentation built on April 21, 2026, 9:07 a.m.