Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

print_labels

Print the labels of a labelled vector


Description

This is a convenience function, useful to explore the variables of a newly imported dataset.

Usage

print_labels(x, name = NULL)

Arguments

x

A labelled vector

name

The name of the vector (optional)

Examples

s1 <- labelled(c("M", "M", "F"), c(Male = "M", Female = "F"))
s2 <- labelled(c(1, 1, 2), c(Male = 1, Female = 2))
labelled_df <- tibble::tibble(s1, s2)

for (var in names(labelled_df)) {
  print_labels(labelled_df[[var]], var)
}

haven

Import and Export 'SPSS', 'Stata' and 'SAS' Files

v2.4.1
MIT + file LICENSE
Authors
Hadley Wickham [aut, cre], Evan Miller [aut, cph] (Author of included ReadStat code), RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.