I'm doing some ifelse statements, but I wonder how to include NA values. My statement is like:

df$x <- ifelse(df$y != df$z, 1, 0)

However if either y or z are equal to NA, the formula return NA rather then 1. I want it to still return 1 because y and z are not equal if one of them is NA.

So this is the output:
y z x
1 1 0
1 2 1
2 NA NA

But I would like it like this:
y z x
1 1 0
1 2 1
2 NA 1