Skip to contents

[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"))
#> Warning: `msub()` was deprecated in harpIO 0.1.0.
#>  Please use `psub()` instead.
#>  [1] "A" "b" "C" "d" "E" "f" "g" "h" "i" "j"
msub(c("a", "b", "ac", "ad"), c("a", "ac"), c("A", "AC"))
#> [1] "A"  "b"  "AC" "ad"
if (FALSE) {
# "ac" is replaced with "Ac" due to substring matching
msub(c("a", "b", "ac", "ad"), c("a", "ac"), c("A", "AC"), regex = TRUE)
}