Hi
I am trying to mutate several variables's observation using case_when and across function. The variables are currentlt of class double coded with 1 and zero and I want to convert the 1's to "yes" and 0's to "No". My code reads as follows.
equip %>%
mutate(
across(starts_with("equip_")),
~ case_when(
.== 1 ~ "Yes",
.== 0 ~ "No"
)
)
It throws the following error which am unable to troubleshoot. Cans someone please assist?
Error in mutate()
:
In argument:
~case_when(. == 1 ~ "Yes", . == 0 ~ "No")
.
Caused by error:
! ~case_when(. == 1 ~ "Yes", . == 0 ~ "No")
must be a vector, not a
object.