how to set na value in r code example Example: r na if dat <- dat %>% mutate(x = replace(x, x<0, NA))