Skip to contents

Manipulating variable labels

Functions to set, manipulate and remove variable labels

var_label() `var_label<-`() get_variable_labels() set_variable_labels() label_attribute() get_label_attribute() set_label_attribute() `label_attribute<-`()
Get / Set a variable label
remove_labels() remove_var_label() remove_val_labels() remove_user_na()
Remove variable label, value labels and user defined missing values
copy_labels() copy_labels_from()
Copy variable and value labels and SPSS-style missing value
update_variable_labels_with() update_value_labels_with()
Update variable/value labels with a function

Manipulating value labels

Functions to set, manipulate and remove value labels

labelled() is.labelled()
Create a labelled vector. (from haven)
val_labels() `val_labels<-`() val_label() `val_label<-`() get_value_labels() set_value_labels() add_value_labels() remove_value_labels()
Get / Set value labels
remove_labels() remove_var_label() remove_val_labels() remove_user_na()
Remove variable label, value labels and user defined missing values
sort_val_labels()
Sort value labels
val_labels_to_na()
Recode value labels to NA
nolabel_to_na()
Recode values with no label to NA
drop_unused_value_labels()
Drop unused value labels
copy_labels() copy_labels_from()
Copy variable and value labels and SPSS-style missing value
update_variable_labels_with() update_value_labels_with()
Update variable/value labels with a function

Data dictionary

Functions to look for keywords variable names / labels and create a data dictionary.

Manipulating SPSS style missing values

Functions to set, manipulate and remove SPSS style missing values

labelled_spss()
Labelled vectors for SPSS (from haven)
na_values() `na_values<-`() na_range() `na_range<-`() get_na_values() get_na_range() set_na_values() set_na_range() is_user_na() is_regular_na() user_na_to_na() user_na_to_regular_na() user_na_to_tagged_na()
Get / Set SPSS missing values
copy_labels() copy_labels_from()
Copy variable and value labels and SPSS-style missing value
remove_labels() remove_var_label() remove_val_labels() remove_user_na()
Remove variable label, value labels and user defined missing values

Tagged missing values

tagged_na() na_tag() is_tagged_na() format_tagged_na() print_tagged_na()
"Tagged" missing values (from haven)
unique_tagged_na() duplicated_tagged_na() order_tagged_na() sort_tagged_na()
Unique elements, duplicated, ordering and sorting with tagged NAs
tagged_na_to_user_na() tagged_na_to_regular_na()
Convert tagged NAs into user NAs

Converting

Functions to convert from and to labelled classes

to_character()
Convert input to a character vector
to_factor() unlabelled()
Convert input to a factor.
to_labelled() foreign_to_labelled() memisc_to_labelled()
Convert to labelled data
update_labelled()
Update labelled data to last version

Other functions and methods

is_prefixed()
Check if a factor is prefixed
recode_if()
Recode some values based on condition
recode(<haven_labelled>)
Recode values
remove_attributes()
Remove attributes
names_prefixed_by_values()
Turn a named vector into a vector of names prefixed by values

Internal datasets for testing