Skip to content

Instantly share code, notes, and snippets.

@jjesusfilho
Last active June 3, 2017 09:54
Show Gist options
  • Save jjesusfilho/a8679e4d3a467ef6bd7db4ce6b8dd689 to your computer and use it in GitHub Desktop.
Save jjesusfilho/a8679e4d3a467ef6bd7db4ce6b8dd689 to your computer and use it in GitHub Desktop.
Wraper da função ifelse do R.
ifs<-function(x,y,z=NULL){
stopifnot(is.list(y))
#if(length(z)==0) {z<-x}
for(i in 1:length(y)){
x<-ifelse(stringr::str_detect(x,y[[i]][1]),y[[i]][2],x)
}
return(x)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment