# create labelled integer, with missing flag
x <- labelled(c(1, 2, 1, 3, 4, 1, 5),
c(Good = 1, Bad = 5))
get_labels(x)
get_labels(x, include.non.labelled = TRUE)
fill_labels(x)
get_labels(fill_labels(x))
# create partially labelled vector with missings
x <- labelled(c(1, 2, 1, 3, 4, 1, 5),
c(Male = 1, Female = 2, Refused = 5),
c(FALSE, FALSE, TRUE))
x
fill_labels(x)
get_labels(fill_labels(x))
# get summary
x <- labelled(c(1, 2, 1, 3, 4, 1, NA, 5),
c(Male = 1, Female = 2, Refused = 5),
c(FALSE, FALSE, TRUE))
summary(x)
Run the code above in your browser using DataLab