replace_names: Replace names using a pattern.

Description Usage Arguments Value See Also Examples

View source: R/generics.R

Description

Replace names using a pattern. Calls stringr::str_replace_all().

Usage

1
replace_names(x, pattern, replacement, ...)

Arguments

x

a named object

pattern

regex pattern

replacement

replacement

...

Arguments passed on to stringr::str_replace_all

string

Input vector. Either a character vector, or something coercible to one.

Value

x with replaced names.

See Also

stringr::str_replace_all()

Examples

1
2
3
fruits <- c(one = "one apple", two = "two pears", three = "three bananas")
replace_names(fruits, '^([a-z])', 'fruit_\\1')
replace_names(fruits, '^([a-z])', toupper)

lgaborini/rstanBF documentation built on March 10, 2021, 1:12 p.m.