Learn R Programming

stringr (version 0.3)

str_replace: Replace replaced occurences of a matched pattern in a string.

Description

Replace replaced occurences of a matched pattern in a string.

Usage

str_replace(string, pattern, replacement)

Arguments

string
input character vector
pattern
pattern to look for, as defined by a POSIX regular expression. See the ``Extended Regular Expressions'' section of regex for details.
replacement
replacement string. References of the form <1>, <2> will be replaced with the contents of the respective matched group (created by ()) within the pattern.

Value

  • character vector.

Details

Vectorised over string. pattern and replacement should both be single strings, i.e. a character vectors of length one.

See Also

gsub which this function wraps