replace_names.Rd
Replace names using a pattern.
Calls stringr::str_replace_all()
.
replace_names(x, pattern, replacement, ...)
x | a named object |
---|---|
pattern | regex pattern |
replacement | replacement |
... | Arguments passed on to
|
x with replaced names.
fruits <- c(one = "one apple", two = "two pears", three = "three bananas") replace_names(fruits, '^([a-z])', 'fruit_\\1')#> Error in replace_names(fruits, "^([a-z])", "fruit_\\1"): could not find function "replace_names"replace_names(fruits, '^([a-z])', toupper)#> Error in replace_names(fruits, "^([a-z])", toupper): could not find function "replace_names"