Description Usage Arguments Value Note Examples
Multiple gsub replacement: Replaces the need for multiple, consecutive gsub functions. If you have more than once replacement rule then this convenience function is appropriate to use.
1 | mgsub(x, replace_list)
|
x |
a character vector where matches are sought, or an object which can be coerced by as.character to a character vector. Long vectors are supported. |
replace_list |
A list of at least length one where each element is of length 2. Each two element vector has the 'old' pattern and the 'new' replacement which are passed to gsub via Reduce. |
a character vector of the same length and with the same attributes as x (after possible coercion to character). Elements of character vectors x which are not substituted will be returned unchanged. See ?gsub for further details.
Code idea taken from: http://stackoverflow.com/questions/15253954/replace-multiple-arguments-with-gsub
1 2 3 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.