# Example gads
example_df <- data.frame(ID = 1:5, mc = c("blue", "blue", "green", "other", "other"),
open = c(NA, NA, NA, "yellow", "blue"),
stringsAsFactors = FALSE)
example_df$mc <- as.factor(example_df$mc)
gads <- import_DF(example_df)
# recode
gads2 <- collapseMC_Text(gads, mc_var = "mc", text_var = "open",
mc_code4text = "other")
Run the code above in your browser using DataLab