tidyr icon indicating copy to clipboard operation
tidyr copied to clipboard

`.by` support in `fill()`/`complete()`/`expand()`

Open markfairbanks opened this issue 2 years ago • 8 comments

To match the .by implementation in dplyr v1.1.0 functions.

  • [x] fill() https://github.com/tidyverse/tidyr/pull/1572
  • [ ] complete()
  • [ ] expand()

markfairbanks avatar Jan 03 '23 22:01 markfairbanks

Will have to wait for tidyr 1.4.0 (i.e. after dplyr 1.1.0 is released)

DavisVaughan avatar Jan 03 '23 23:01 DavisVaughan

@DavisVaughan does it have to? We added it to the upcoming dbplyr release.

hadley avatar Jan 07 '23 20:01 hadley

That seems different though because dbplyr controls the whole underlying implementation. Here we just pass through to a dplyr function like mutate() or summarise(), so without dplyr 1.1.0 the arguments wouldn't do anything.

I guess we could check to see if dplyr 1.1.0 is installed if .by is attempted to be used and error if there isn't a new enough version of dplyr, but that didn't feel worth it when I originally thought about this

DavisVaughan avatar Jan 08 '23 19:01 DavisVaughan

Ok, makes sense.

hadley avatar Jan 09 '23 13:01 hadley

Absolutely love the addition of the per-operation .by/by arguments in dplyr. Now that dplyr 1.1.0 is released, will these be added to the aforementioned tidyr functions. Seems like tidyr::nest() already got the makeover.

mattwarkentin avatar Feb 02 '23 22:02 mattwarkentin

We will add them in the next tidyr release. It was easier with nest() because tidyr owns the implementation. With the others we call out to dplyr so we needed to wait on 1.1.0

DavisVaughan avatar Feb 06 '23 15:02 DavisVaughan

+1 on adding .by to complete and expand

joeycouse avatar Aug 15 '25 15:08 joeycouse

Hi @DavisVaughan Is a release planned in the near future? The PR has been merged for more than 1 year now, and it would be nice to be able to enjoy fill(.by), even if the other two are not done yet.

DanChaltiel avatar Sep 10 '25 08:09 DanChaltiel