Use relationship
on dplyr >=1.1.0.9000
#8
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We are preparing to release dplyr 1.1.1 and this package popped up in the revdep checks.
We realized that we didn't get the
multiple
argument quite right the first time around 😞 . It was too aggressive since it warned on both one-to-many and many-to-many joins. In 1.1.1 we've made two improvements:multiple
now defaults to"all"
. The options ofNULL
,"error"
, and"warning"
are deprecated.relationship
is a new argument to add known constraints onto the join procedure, such as"many-to-one"
, which replacesmultiple = "error"
.The default of
relationship
checks to see if there is amany-to-many
relationship between the keys ofx
andy
and will warn if one is present. This should be much rarer than what we checked for before, and targets the most dangerous case that we were trying to warn the user about.You can read all about
relationship
here tidyverse/dplyr#6753, along with the issues linked there.Unfortunately it does affect some tests here. You are doing one of the few cases where a many-to-many join is reasonable (i.e. a kind of self-join between
cr
to itself), but this is still pretty rare. I think the easiest thing to do is to just branch off the dplyr version that is installed and setrelationship = "many-to-many"
ormultiple = "all"
accordingly.We plan to submit dplyr 1.1.1 in 2-3 weeks.
This should be compatible with both dev and CRAN dplyr. It would help us out if you could go ahead and send a patch version of your package to CRAN ahead of time! Thanks!