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

map_vec #435

Closed
hadley opened this issue Jan 1, 2018 · 3 comments · Fixed by #894
Closed

map_vec #435

hadley opened this issue Jan 1, 2018 · 3 comments · Fixed by #894
Labels
feature a feature request or enhancement map 🗺️ vctrs ♣️
Milestone

Comments

@hadley
Copy link
Member

hadley commented Jan 1, 2018

Would take a col_type argument a la readr (although the semantics would be a little different)

@hadley hadley added the feature a feature request or enhancement label Feb 4, 2018
@hadley hadley changed the title map_c map_vec May 5, 2018
@hadley
Copy link
Member Author

hadley commented May 5, 2018

Waiting for vector coercion/combination from vctrs

@huftis huftis mentioned this issue May 22, 2018
@1danjordan
Copy link
Contributor

1danjordan commented Nov 5, 2018

This probably isn't your preference, but I like the idea of adding a .type argument to purrr::map, to specify which S3 vector to return - default being a list. Then it wouldn't be necessary to add another map_ function to the API, and then there would be only one map function that would serve most needs. Either way, really looking forward to purrr + vctrs integration!

@hadley
Copy link
Member Author

hadley commented Nov 5, 2018

The problem is what happens if the .type is not specified? map() would always return a list; map_vec() would return something simpler.

@lionel- lionel- added this to the vctrs milestone Nov 30, 2018
hadley added a commit that referenced this issue Aug 27, 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
feature a feature request or enhancement map 🗺️ vctrs ♣️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants