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

Rename transpose() to list_transpose() #875

Closed
hadley opened this issue Aug 24, 2022 · 1 comment · Fixed by #909
Closed

Rename transpose() to list_transpose() #875

hadley opened this issue Aug 24, 2022 · 1 comment · Fixed by #909
Labels
feature a feature request or enhancement list 🧦 vctrs ♣️

Comments

@hadley
Copy link
Member

hadley commented Aug 24, 2022

And broadly reconsider its scope and implementation given vctrs and tidyr.

Related issues:

@hadley
Copy link
Member Author

hadley commented Aug 27, 2022

One possible implementation would be to use map_vec() to get automatic simplification, something like this:

list_transpose <- function(x) {
  map(vec_index(x), ~ map_vec(x, .x))
}

Or maybe:

list_transpose <- function(x, template = vec_index(x), .ptype = NULL) {
  map(index, ~ map_vec(x, .x, .ptype = .ptype[.x]))
}

This will be much slower than the existing transpose() implementation, but it'll be vastly more robust.

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 list 🧦 vctrs ♣️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant