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

Use some vctrs principle in modify() and friends #928

Closed
hadley opened this issue Sep 10, 2022 · 0 comments · Fixed by #894
Closed

Use some vctrs principle in modify() and friends #928

hadley opened this issue Sep 10, 2022 · 0 comments · Fixed by #894

Comments

@hadley
Copy link
Member

hadley commented Sep 10, 2022

Or maybe this can be map_vec()?

modify.vector <- function(.x, .f, ...) {
  map_vec(.x, .f, ..., .ptype = .x)
} 
@hadley hadley changed the title Use vec_slice() in modify Use some vctrs principle in modify() and friends Sep 15, 2022
hadley added a commit that referenced this issue Sep 17, 2022
New `map_vec()`, `map2_vec()`, and `pmap_vec()` return a vector the same length as `x` with type determined by the returned type of `.f`. Fixes #435

`modify()`, `modify_if()`, `modify_at()`, and `modify2()` have been rewritten from scratch. They are no longer generic and should work with a wider range of (future) classes from the vctrs package. Fixes #928

All the tests for these functions have been substantially revamped to do a better job of illustrating the underlying invariants.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant