R/mgsub.R

mgsub<-function (pattern, replacement, x, ...) 
{
  if (length(pattern) != length(replacement)) {
    stop("pattern and replacement do not have the same length.")
  }
  result <- x
  for (i in 1:length(pattern)) {
    result <- gsub(pattern[i], replacement[i], result, ...)
  }
  result
}
msuprun/bbeaR documentation built on Jan. 31, 2021, 6:49 p.m.