Last active
November 21, 2017 19:47
-
-
Save klmr/41326eae65642efa6d22b9b9b1358452 to your computer and use it in GitHub Desktop.
Missing `mutate_when` function for dplyr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
modules::import_package('rlang', attach = TRUE) | |
mutate_when = function (.data, .filter, ...) { | |
dots = dots_definitions(...)$dots | |
rows = eval_tidy(enquo(.filter), .data) | |
.data[rows, names(dots)] = | |
lapply(dots, eval_tidy, data = .data[rows, , drop = FALSE]) | |
.data | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment