mgsub: generalization of gsub

Description Usage Arguments Value Examples

View source: R/utils.R

Description

a generalization of gsub which allows to do multiple replacements at once as described in stackoverflow

Usage

1
mgsub(myrepl, mystring)

Arguments

myrepl

a list containing character vectors of length two each with the string to be replaced at the first and the replacement at the second index

mystring

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

Value

a character string

Examples

1
2
3
mystring = 'This is good'
myrepl = list(c('o', 'a'), c('i', 'n'))
mgsub(myrepl, mystring)

konradmayer/trlboku documentation built on July 3, 2020, 9:49 p.m.