I want to create a binary variable about people being interested in professional practices. I did so with the different options, but I can't seem to find a way to attribute the value 0 to observations. Does someone know how?
ECEMD <-
ECEMD %>%
mutate(PROFSKILL_PROFPRACTICE_INDICE2 = case_when(
PROFSKILL_PROFPRACTICE_DIM == "Did not participate" ~ 0,
PROFSKILL_PROFPRACTICE_DIM == "Not applicable" ~ 0,
PROFSKILL_PROFPRACTICE_DIM == "Excellent" ~ 1,
PROFSKILL_PROFPRACTICE_DIM == "Poor" ~ 1,
PROFSKILL_PROFPRACTICE_DIM == "Fair" ~ 1,
PROFSKILL_PROFPRACTICE_DIM == "Good" ~ 1,
PROFSKILL_PROFPRACTICE_DIM == "Very good" ~ 1,
PROFSKILL_PROFPRACTICE_DIM == NA ~ 0))
freq(ECEMD$PROFSKILL_PROFPRACTICE_INDICE2)
UPDATE:
Okay, I tried
ECEMD <-
ECEMD %>%
mutate(PROFSKILL_PROFPRACTICE_INDICE2 = case_when(
PROFSKILL_PROFPRACTICE_DIM %in% c("Did not participate",
"Not applicable",
NA) ~ 0,
PROFSKILL_PROFPRACTICE_DIM %in% c("Excellent",
"Poor",
"Fair",
"Good",
"Very good") ~ 1))
But the NA are still not changed to 0. What do?