Description Usage Arguments Value Examples
Replace elements matching a regular expression with replacement
.
1 | replace_regex(vector, regex, replacement, warn = TRUE)
|
vector |
Vector to replace matches in. |
regex |
A regular expression (must be a single element). |
replacement |
Value to replace matches with (must be a single element). |
warn |
Logical indicating whether to issue a warning message if no element is replaced. |
Vector
with all elements matching regex
replaced by
replacement
.
Note that factors will be releveled with the replacement values and levels no longer present in the factor may be lost.
1 2 | replace_regex(c("Farmworker", "Programmer", "Farmhand", "Pole vaulter",
"Farmer", "Dancer"), regex = "^Farm.", replacement = "Farmer")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.