multigsub: Multiple gsub

Description Usage Arguments Value See Also Examples

Description

multigsub - Borrowed from qdap library. A wrapper for gsub that takes a vector of search terms and a vector or single value of replacements.

Usage

1
mgsub(pattern, replacement, text.var, fixed = TRUE, ...)

Arguments

pattern

Character string to be matched in the given character vector.

replacement

Character string equal in length to pattern or of length one which are a replacement for matched pattern.

text.var

The text variable.

fixed

logical. If TRUE, pattern is a string to be matched as is. Overrides all conflicting arguments.

...

Additional arguments passed to gsub.

Value

multigsub - Returns a vector with the pattern replaced.

See Also

gsub

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
## ======================
##    `mgsub` Function
## ======================

mgsub(c("it's", "I'm"), c("it is", "I am"), DATA$state)
mgsub("[[:punct:]]", "PUNC", DATA$state, fixed = FALSE)


## End(Not run)

linogaliana/tablelight documentation built on Jan. 29, 2021, 10:30 a.m.