-
Notifications
You must be signed in to change notification settings - Fork 186
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
Add new map_vec() to purrr_mappers vector #1866
Conversation
thanks! could you add yourself to the NEWS item and add a test for this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, purrr 1.0.0 is already on CRAN. Cool!
Thanks.
Codecov Report
@@ Coverage Diff @@
## main #1866 +/- ##
=======================================
Coverage 98.86% 98.86%
=======================================
Files 112 112
Lines 4839 4839
=======================================
Hits 4784 4784
Misses 55 55
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Should map2_vec and pmap_vec also be included? |
Then all |
ah, nvm, I didn't read the docs enough... actually I'm surprised mapply is there, maybe it shouldn't be. the logic would be different for the >1-arg function case |
But if I understand correctly, it clashes with lintr/R/unnecessary_lambda_linter.R Line 34 in 7657984
|
I guess I'd you're using mapply(function(x) x, 1:10) that is indeed a lint but I still assume the logic is off more generally. anyway, that's for a follow-up issue |
On the same note, |
Should I just expand on the existing news bullet rather than adding a new one since there hasn't been a release since this linter was created? Lines 98 to 100 in 67576ef
|
yes exactly, I would just add to the bullet with your name and this PR number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
"purrr::map_vec(x, ~foo(.x, y))", | ||
rex::rex("Pass foo directly as a symbol to map_vec()"), | ||
unnecessary_lambda_linter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MichaelChirico is this recommending you use map_vec(x, foo, y = y)
instead?
We actually recommend using the anonymous function form rather than using ...
to pass named arguments through to foo()
now. Using the anonymous function form makes it a little easier to see which arguments belong to which function (i.e. does y
belong to map_vec()
or foo()
?), and tends to give slightly better error messages. See the new documentation of ...
at https://purrr.tidyverse.org/reference/map.html for more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Davis! Given that recommendation I think we should exclude purrr mappers by default; filed #1871 to handle that before release.
No description provided.