x <- declared(
c(-2, 1:5, -1),
labels = c("Good" = 1, "Bad" = 5, "DK" = -1),
na_values = c(-1, -2),
label = "Test variable"
)
x
labels(x)
labels(x, prefixed = TRUE)
labels(x) <- c("Good" = 1, "Bad" = 5, "DK" = -1, "Not applicable" = -2)
label(x)
label(x) <- "This is a proper label"
x
Run the code above in your browser using DataLab