re_substitutes | R Documentation |
Substitute regular expressions in a string with another string.
re_substitutes(data, pattern, replacement, global = FALSE, options = NULL, ...)
data |
character vector to substitute |
pattern |
regular expression to match |
replacement |
replacement text to use |
global |
substitute all occurrences |
options |
option flags |
... |
options passed to sub or gsub |
regexp
Section "Perl-like Regular Expressions" for a
discussion of the supported options
string <- c("this is a Test", "string")
re_substitutes(string, "test", "not a test", options = "insensitive")
re_substitutes(string, "i", "x", global = TRUE)
re_substitutes(string, "(test)", "not a \\1", options = "insensitive")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.