Consider I have two vectors
a <- c(1,3,5,7,9, 23,35,36,43)
b <- c(2,4,6,8,10,24, 37, 45)
Please notice the length
of both are different.
I want to find the gap/difference/sequence between two vectors to match based on closest proximity.
Expected Output
a b
1 2
3 4
5 6
7 8
9 10
23 24
35 NA
36 37
43 45
Please notice that 35
has NA
against it because 36
has a sequence matching/closest proximity with 37
.