# labelled vector with multiple types of missing values
x <- labelled(c("M", "M", "F", "X", "N/A"),
c(Male = "M", Female = "F", Refused = "X", "Not applicable" = "N/A"),
c(FALSE, FALSE, TRUE, TRUE))
x <- labelled(c(1, 2, 1, 5, 1, 5, 9),
c(Male = 1, Female = 2, Refused = 5, Missing = 9),
c(FALSE, FALSE, TRUE, TRUE))
Run the code above in your browser using DataLab