replaceStr | R Documentation |
This function replaces occurrences of a given substring (pattern
) in a text (intext
) with a new substring (replacement
).
You can also specify if you want to replace only whole words and whether to ignore case.
replaceStr(pattern, replacement, intext, word = FALSE, ignore.case = TRUE)
pattern |
The substring that you want to replace. |
replacement |
The new substring that will replace |
intext |
The input text where you want to replace the substring. |
word |
Logical, if TRUE only whole words will be replaced. |
ignore.case |
Logical, if TRUE the function ignores case. |
A string with the replaced substrings.
replaceStr( "world", "everyone","Hello world")
replaceStr("WORLD", "everyone","Hello world", ignore.case = TRUE)
replaceStr( "world", "everyone","Hello world", word = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.