I try to do this in R:(for example)
let x = c(1,2,3,4,5,6,7,8)
and y=c(1,2,8)
So
x[x!=y] = numeric(0) ????
I want to get as a result 3,4,5,6,7
Is there a practical way to do this? Thanks
Use value matching %in%
and remove the elements of x
that are present in y
x[-which(x %in% y)]
#[1] 3 4 5 6 7