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
}
maytesuarezfarinas/cosinoRmixedeffects documentation built on Oct. 30, 2024, 9:31 p.m.