I have two vectors with different elements, say x=c(1,3,4)
, y= c(2,9)
I want a vector of ranges that identifies me the elements of vector x
with 1 and those of y
with 0, ie
(1,2,3,4,9) -----> (1,0,1,1,0)
How could you get the vector of zeros and ones (1,0,1,1,0) in r?
Thanks