powered by
NAtoCategory(fact, label = "missing")
set.seed(1977) fact <- factor(sample(c(round(runif(10, 1, 3)), rep(NA, 10))), levels = 1:3, labels = c("no", "maybe", "yes")) NAtoCategory(fact)
Run the code above in your browser using DataLab