subMultiple: subVector

Description Usage Arguments Details Value Author(s) Examples

View source: R/subMultiple.r

Description

Substitutes multiple patterns and corresponding replacements

Usage

1
2
3
subVector(x, toSub)

subMultiple(x, pattern, replacement)

Arguments

x

Vector of text to search

toSub

Named vector where the elements are the pattern and the names are the replacement values

pattern

Vector of patterns to find in each element of x

replacement

Vector of replacement values corresponding to each value of pattern

Details

Given a vector of text replaces all paterns each each element

Value

The text in x with substitutions made

Author(s)

Jared P. Lander

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
theText <- c('Hi Bob & Cooper how is life today', 
'Anything happening now?', 
'Sally & Dave are playing with Jess & Julio | with their kids')
subVector(theText, toSub=c("and"='&', 'or'='\\|'))
subVector(theText)

theText <- c('Hi Bob & Cooper how is life today', 
'Anything happening now?', 
'Sally & Dave are playing with Jess & Julio | with their kids')
subMultiple(theText, pattern=c('&', '\\|'), replacement=c('and', 'or'))

useful documentation built on May 19, 2017, 11:32 p.m.

Search within the useful package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.