Convert vector to labelled class
Converts a (labelled) vector of any class into a labelled
class vector, resp. adds a labelled
class-attribute.
as_labelled( x, add.labels = FALSE, add.class = FALSE, skip.strings = FALSE, tag.na = FALSE )
x |
Variable (vector), |
add.labels |
Logical, if |
add.class |
Logical, if |
skip.strings |
Logical, if |
tag.na |
Logical, if |
x
, as labelled
-class object.
data(efc) str(efc$e42dep) x <- as_labelled(efc$e42dep) str(x) x <- as_labelled(efc$e42dep, add.class = TRUE) str(x) a <- c(1, 2, 4) x <- as_labelled(a, add.class = TRUE) str(x) data(efc) x <- set_labels(efc$e42dep, labels = c(`1` = "independent", `4` = "severe dependency")) x1 <- as_labelled(x, add.labels = FALSE) x2 <- as_labelled(x, add.labels = TRUE) str(x1) str(x2) get_values(x1) get_values(x2)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.