mgsub: Multiple replacements with gsub

Description Usage Arguments Value

Description

A function to run multiple gsub commands at once on a single string; if you hve many patterns and many replacements, this is very efficient code. Taken from https://stackoverflow.com/questions/15253954/replace-multiple-letters-with-accents-with-gsub

Usage

1
mgsub(pattern, replacement, x)

Arguments

pattern

vector containing one or more regular expressions (or character string for fixed = TRUE) to be matched in the given character vectors.

replacement

vector containing one or more replacements for matched pattern. Must be the same length as pattern.

x

a character vector where matches are sought, or an object which can be coerced by as.character to a character vector.

Value

vector x with substituted values


bvidgen/tc documentation built on May 9, 2019, 2:21 a.m.