Description Usage Arguments Details Value Author(s) See Also
These functions provide convenient pattern finding and substitution for multiple patterns.
1 2 3 4 |
patterns |
A character vector of patterns. |
replacements |
A character vector of replacements; must be of the same length as |
x |
Character vector of strings in which the pattern finding and replacements should be carried out. |
sort |
Logical: should the output indices be sorted in increasing order? |
invert |
Logical: should the search be inverted and only indices of elements of |
... |
Other arguments to |
For each element of x, patterns are sequentiall searched for and (for multiSub and
multiGSub substituted with the corresponding replacement.
multiSub and multiGSub return a character vector of the same length as x, with all
patterns replaces by their replacements in each element of x. multiSub replaces each pattern in
each element of x only once, multiGSub as many times as the pattern is found.
multiGrep returns the indices of those elements in x in which at least one of patterns
was found, or, if invert is TRUE, the indices of elements in which none of the patterns were found.
multiGrepl returns a logical vector of the same length as x, with TRUE is any of the
patterns matched the element of x, and FALSE otherwise.
Peter Langfelder
The workhorse functions sub, gsub, grep and grepl.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.