Commit 75219be4 authored by Holger Brandl's avatar Holger Brandl

added mutate_cond

parent 3dd71138
......@@ -407,6 +407,15 @@ mutate_inplace <- function(data, var, expr){
# mutate_inplace( iris, Species, str_replace("vir", "foo") )
# from https://stackoverflow.com/questions/34096162/dplyr-mutate-replace-on-a-subset-of-rows
mutate_cond <- function(.data, condition, ..., envir = parent.frame()) {
condition <- eval(substitute(condition), .data, envir)
.data[condition, ] <- .data[condition, ] %>% mutate(...)
.data
}
reload_dplyr <- function(){
unloadNamespace('tidyr')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment