In R it can be useful to write your own functions and use them
equals_withna <- function(a,b) {
ifelse(test = a != b | (xor(is.na(a) , is.na(b)))
, yes = 1, no = 0)}
df <- data.frame(t=c(0,1,2,3),
u=c(1,1,2,3),
y=c(0,1,NA,2),
z=c(0,1,2,3))
df$x <- pmax(equals_withna(df$t,df$u),equals_withna(df$y,df$z))
df