The new dplyr version, 1.1.0, introduces the "rolling join", which finds "the closest match". It is based on inequalities: for example, it can find the value of data frame B that is closest from below or closest from above to each value in data frame A. To do this it uses the syntax join_by(closest(a <= b))
. Examples are given in the tidyverse blog post: dplyr 1.1.0 is coming soon
My question is whether there is an analogous function that allows us to find the closest match. My intuition suggests join_by(closest(a == b))
, but that does not work.