Description Usage Arguments Value See Also Examples
Replace a vector of matches using gsub
recursively
1 |
pattern |
character vector containing the pattern(s) to be matched. |
replacement |
character vector containing the replacement(s) for the matched patterns. |
x |
character vector in which the pattern(s) are to be replaced. |
... |
additional parameters to be passed to |
character vector equal in length to the vector provided via argument x
.
grep
for possible arguments to pass via ...
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Many-to-many replacement
patterns <- c("a", "b", "c")
replacements <- c(1, 2, 3)
rGsub(
pattern = patterns,
replacement = replacements,
x = letters
)
## Many-to-one replacement
replacement <- 123
rGsub(
pattern = patterns,
replacement = replacement,
x = letters
)
## One-to-one replacement
pattern <- "a"
rGsub(
pattern = pattern,
replacement = replacement,
x = letters
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.