I have a data frame that looks like the below:
Word Value1 Value2
Apple True True
Chair True False
nonWord False False
Hat False True
... ...
I'm attempting to change all the values of nonWords to NA
's.
data %>%
mutate(Value1 = ifelse(Word == "nonWord", NA, Value1)) %>%
mutate(Value2 = ifelse(Word == "nonWord", NA, Value2))
However, this does not seem to be working since my values are not being replaced by NA
's. Does anyone know what I'm doing wrong?
Desired output:
Word Value1 Value2
Apple True True
Chair True False
nonWord NA NA
Hat False True
... ...