# create labelled factor, with missing flag
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))
get_na(x)
# create labelled integer, with missing flag
x <- labelled(c(1, 2, 1, 3, 4, 1),
c(Male = 1, Female = 2, Refused = 3, "N/A" = 4),
c(FALSE, FALSE, TRUE, TRUE))
get_na(x)
Run the code above in your browser using DataLab