Learn R Programming

sjPlot (version 1.7)

get_val_labels: Retrieve value labels of a variable or an SPSS-imported data frame

Description

This function retrieves the value labels of an imported SPSS data set (via read_spss) and
  • ifxis a data frame, returns the all variable's value labels aslistobject
  • or, ifxis a vector, returns the label as string.

Usage

get_val_labels(x)

Arguments

Value

Either a list with all value labels from the data frame's variables, or a string with the value labels, if x is a variable.

See Also

Examples

Run this code
# import SPSS data set
# mydat <- read_spss("my_spss_data.sav", enc="UTF-8")

# retrieve variable labels
# mydat.var <- get_var_labels(mydat)

# retrieve value labels
# mydat.val <- get_val_labels(mydat)

data(efc)
get_val_labels(efc$e42dep)

Run the code above in your browser using DataLab