I have two data frames (A & B) of different lengths. For a given value in A, I want to know if there are values anywhere in B that are within a tolerance of +/- 0.3. It would also be useful to know the position of this value in B.
A<-c(1:10)
B<-c(2.2,15,1.8,4.9,20,14,8.2,33,9.8,41,16)
i.e for A[1] there is no value in B within the tolerance,
but for A[2], the values at B[1] and B[3] are within the tolerance, and so on.
I have experimented with the near function in dplyr, however I can only seem to get it to compare on a row by row basis. Any help would be greatly appreciated!