I have two binary vectors, b1 and b2, with values of either 0 or 1. b1 has always fewer true values or ones than b2. The true values rarely overlap, i.e. have the same index.
What I want to do is to use the index of when b1 is 1 and set the closest true value or 1 in b2 to false or 0.
Basically I want to remove duplicates from b2, but if they don't overlap I want to remove closest true value.
Best Answer