This function was deprecated as it is replaced by psub
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 inpattern
are matched exactly.- ...
Other arguments to gsub
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)
}