msub: Multiple pattern matching and replacement

View source: R/msub.R

msubR Documentation

Multiple pattern matching and replacement

Description

[Deprecated]

This function was deprecated as it is replaced by psub

Usage

msub(x, pattern, replacement, regex = FALSE, ...)

Arguments

x

A character vector.

pattern

A character vector of patterns to replace.

replacement

A character vector of the same length as pattern with the corresponding replacements.

regex

A logical to denote whether pattern is a regular expression (TRUE) or a string to match exactly (FALSE). The default is FALSE so strings in pattern are matched exactly.

...

Other arguments to gsub

Value

A character vector of the same length as x

Examples

msub(letters[1:10], c("a", "c", "e"), c("A", "C", "E"))
msub(c("a", "b", "ac", "ad"), c("a", "ac"), c("A", "AC"))
## Not run: 
# "ac" is replaced with "Ac" due to substring matching
msub(c("a", "b", "ac", "ad"), c("a", "ac"), c("A", "AC"), regex = TRUE)

## End(Not run)

andrew-MET/harpIO documentation built on March 7, 2024, 7:48 p.m.