Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify argument flexibility of both single value and named list of values #1284

Closed
7 tasks done
DavisVaughan opened this issue Dec 20, 2021 · 1 comment · Fixed by #1287
Closed
7 tasks done

Unify argument flexibility of both single value and named list of values #1284

DavisVaughan opened this issue Dec 20, 2021 · 1 comment · Fixed by #1287
Labels
feature a feature request or enhancement

Comments

@DavisVaughan
Copy link
Member

DavisVaughan commented Dec 20, 2021

  • Also remove NEWS bullet about moving towards ptype = list()

unchop()

  • ptype = list()
    • Change to ptype = NULL (original behavior)
    • Use is_ptype() and wrap into a named list with names of cols if TRUE
    • Useful when you only specify 1 column to unchop, which is most of the time

unnest()

  • ptype = list()
    • Inherits unchop behavior
    • Change to ptype = NULL (original behavior)

pivot_longer()

  • values_ptypes = list() and names_ptypes = list()

    • Change to = NULL
    • Use is_ptype() and wrap into a named list with names of names_from or values_from
  • values_transform = list() and names_transform = list()

    • Change to = NULL
    • Wrap if not a list, then map over list with as_function()

unnest_longer() / unnest_wider() / hoist()

  • ptype = list()

  • transform = list()


Already done, or not touching

pivot_wider()

  • values_fill = NULL

    • Allows scalar value
    • Allows named list of scalar values
  • values_fn = NULL / unused_fn = NULL

    • Allows single function
    • Allows named list of functions

replace_na() / complete()

  • fill = list()
    • Not updating this one. This controls both the overall selection AND the replacement value. Allowing fill = 0 would fill all columns in the data frame with 0 where there were missing values, which means all columns had to be the same type, which is rare.
@DavisVaughan
Copy link
Member Author

DavisVaughan commented Dec 20, 2021

I think this will break dbplyr because it has a method for pivot_longer() that sets names_ptypes = list(), and that has a new meaning now. It looks like these arguments aren't supported in dtplyr, so it should be fine there. I don't think any of the other functions should have any issues.

We may have to temporarily make names_ptypes = list() and values_ptypes = list() in pivot_longer() be treated like NULL with a warning until dbplyr can update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant