dplyr 1.1.0 new rolling join feature: join by closest value?

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.

1 Like

I had the same question. Did you figure it out yet?

As far as I could tell, there isn't one. It is not like there aren't other ways of achieving this goal, but given that we already have the join_by(closest(a <= b)) syntax, it would be very nice to also be able to do join_by(closest(a == b))

2 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.