# 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)
# sample data set has not attached variable labels to each vector
# so we have to do this first... use 'autoAttachVarLabels' in
# function 'read_spss' to automatically perform this step.
efc <- set_var_labels(efc, get_var_labels(efc))
# get variable lable
get_var_labels(efc$e42dep)
# alternative way
get_var_labels(efc)["e42dep"]
Run the code above in your browser using DataLab