We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This would be something similar to case_when(), but for mapping conditions to operations -- something like a generalized switch.
case_when()
As an example, the following code:
mtcars %>% map_when( starts_with("d") ~ prod(.), contains("a") ~ sum(.), c("mpg", "cyl") ~ cor(.) )
would evaluate to something like:
> mtcars %>% map_when( + starts_with("d") ~ prod(.), + contains("a") ~ sum(.), + c("mpg", "cyl") ~ cor(.) + ) [[1]] [1] 1.218225e+91 [[2]] [1] 336.09 [[3]] mpg cyl mpg 1.000000 -0.852162 cyl -0.852162 1.000000
Would this be worth adding to rlang (or somewhere similar)? Or does this already exist as some function I'm not aware of?
rlang
The text was updated successfully, but these errors were encountered:
That might fit in the vctrs package, which will probably be the home of case_when() in the future.
Sorry, something went wrong.
/move to vctrs
and nothing happens :p where are you move bot?
This issue was moved by lionel- to r-lib/vctrs#66.
No branches or pull requests
This would be something similar to
case_when()
, but for mapping conditions to operations -- something like a generalized switch.As an example, the following code:
would evaluate to something like:
Would this be worth adding to
rlang
(or somewhere similar)? Or does this already exist as some function I'm not aware of?The text was updated successfully, but these errors were encountered: