Learn R Programming

sjmisc (version 1.7)

remove_labels: Remove value labels from variables

Description

This function removes labels from a label attribute of a vector x, resp. from a set of vectors in a data.frame or list-object. The counterpart to this function is add_labels.

Usage

remove_labels(x, value)

remove_labels(x) <- value

Arguments

x
Variable (vector), list of variables or a data.frame where value label attributes should be removed.
value
Either a numeric vector, indicating one or more label attributes that should be removed (see get_labels to retrieve a vector's label attributes), or a character vector with names of label attributes that

Value

  • x with removed value labels.

See Also

set_labels to add value labels, replacing the existing ones; add_labels to add new labels to a vector.

Examples

Run this code
data(efc)
get_labels(efc$e42dep)

x <- remove_labels(efc$e42dep, 2)
get_labels(x, include.values = "p")

x <- remove_labels(efc$e42dep, "independent")
get_labels(x, include.values = "p")

Run the code above in your browser using DataLab