Learn R Programming

rex (version 0.1.0)

re_substitutes: Substitution function

Description

Substitution function

Usage

re_substitutes(data, pattern, replacement, global = FALSE, options = NULL,
  ...)

Arguments

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

See Also

regexp Section "Perl-like Regular Expressions" for a discussion of the supported options

Examples

Run this code
string = c("this is a Test", "string")
re_substitutes(string, "test", "not a test", options = "insensitive")
re_substitutes(string, "i", "x", global = TRUE)

Run the code above in your browser using DataLab