tidyr
tidyr copied to clipboard
Adjust dots in pivoting functions
Closes #1350
pivot_longer()andpivot_wider()dots have been moved to the front, after the required args but before any optional ones.check_dots_used()ensures that typos are caught.pivot_longer_spec(),pivot_wider_spec(),build_longer_spec(), andbuild_wider_spec()have all gained dots that are also placed up front.check_dots_empty()ensures that typos are caught.
This should make it much easier to extend these functions going forward. I see two big benefits:
- For developers: it should mean we can add arguments to the generic after the
...and not automatically break any packages that have added S3 methods for these functions - For users: it forces them to specify arguments by name, creating more robust and readable code. We will be able to add new arguments in any order we prefer and not have to worry about positional argument issues.
I'll run revdeps, I'm hoping it clears up the S3 related issues from here https://github.com/tidyverse/tidyr/pull/1347#issuecomment-1095147941
Breaks 11 packages, but does fix the 3 packages that had S3 consistency issues, which is good news.
The 11 breakages are mainly due to people doing pivot_wider(df, id, <more named args>), i.e. they weren't specifying the id_cols argument by name, which is a little unfortunate.
I still think it is worth making patches for those packages and pushing through with this, they should be easy fixes. If we do this, future maintenance should be much easier and less prone to breaking packages.
Maybe look for a fallback idea?
Check for a single unnamed argument to see if id_cols is being used without being named. Throw a warning and make that work anyways as a temporary fallback
Revdeps with compat behavior running at "04115383-fc69-415d-b648-4ffc8d9fb4c0"
Revdep summary looks good. @hadley I think this is ready for a review now.
Only 1 package has an issue related to this PR, {faux}. 4 failures in total that actually seem tidyr related.
It did fail to check 26 revdeps though.
pivot_longer() dots
- faux needs to name args in
pivot_longer()in thecontinuous.Rmdvignette
allow_rename = FALSE tidy selection
- ggpubr needs to unname tidy selection in
...before call tounite() - metaconfoundr needs to unname tidy selection before call to
pivot_longer() - recipes needs to unname tidy selection before call to
drop_na()
stringr
- cmcR stringr failure
- mpwR stringr failure
- tidyfst stringr failure
False alarms
- openalexR can't reproduce locally, my guess is there was a download failure