I want to count how many difference between x and y where x and y from binomial distribution. I have done the following code but I want more simpler way:
x <- rbinom(20, 1, 0.7)
y <- rbinom(20, 1, 0.4)
z <- 0
for (i in 1:20){
if (x[i]!=y[i]){
z <- z+1
}
}