I want to recode values below 0 to NA with dpylr::if_else, leaving all other values unchanged. I know there are other ways to do this, but I can't figure out why this doesn't work:
data %>% mutate(x = if_else(x < 0, NA, x))
R returns this:
"
false
must be a logical vector, not a double vector."
I wish for false
to remain the original values.