R/multigrepl.R

Defines functions multigrepl

multigrepl <- function(patterns,
                       x,
                       returnMatchesForPatterns=TRUE,
                       ...) {
  if (returnMatchesForPatterns) {
    bindFun <- rbind;
  } else {
    bindFun <- cbind;
  }
  res <- do.call(bindFun,
                 lapply(patterns,
                        grepl,
                        x=x,
                        ...));
  res <- apply(res,
               1,
               any);
  return(res);
}

Try the rock package in your browser

Any scripts or data that you put into this service are public.

rock documentation built on Dec. 28, 2022, 1:55 a.m.