Add grouped-df method for complete()
#1289
Merged
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.
Closes #396
Closes #966
Closes #1110
Closes #1288 (Alternate approach)
Here is CRAN
complete()
, which demonstrates the issue from #396.complete()
on a grouped data frame should work like:In other words, we should have gotten this:
The issue is that there is no grouped-df method for
complete()
, so we end up correctly doing the expansion by group using the grouped-df part ofexpand()
, but we don't do the join right. Rather than joining each expansion to each individual group it was expanded from, we join the total expanded result to the original data, which results in the wrongly filled values from above.I feel that we probably didn't ever need a grouped-df method for
expand()
for a few reasons:crossing()
wrapper! So it should return a bare tibble.expand()
should be that it never returns duplicated rows. But that can happen through the grouped-df method (see below)complete()
, which is added hereThat said, I think removing the grouped-df method for
expand()
would probably break at least one revdep (I haven't checked), so I am not doing that here.