I have a data set and one of its column has factor levels \"a\" \"b\" \"c\" \"NotPerformed\". How can I change all the \"NotPerformed\" factors to
Set one of the levels to NA through tidyverse Pipeline, %>%.
This may serve better as a comment, but I do not have that many reputation.
In my case, the income variable is int with values of c(1:7, 9). Among the levels, "9" represents "Do not wish to answer".
## when all int should be fctr
New_data <- data %>% mutate_if(is.integer, as.factor) %>%
mutate(income = fct_recode(income, NULL = "9"))
I also tried recode(), it does not work.