View source: R/str_replace_nth.R
str_replace_nth | R Documentation |
A more refined replacement function than 'str_replace()' and 'str_replace_all()'
str_replace_nth(x, pattern, replacement, n)
x |
Pass string character |
pattern |
String containing characters to match |
replacement |
String containing characters to replace. |
n |
Nth term to be replaced |
x <- "pineapplepie"
str_replace_nth(x = x, pattern = "p", replacement = "q", n = 2)
str_replace_nth(x = "pigpig", pattern = "pig", replacement = "dog", n = 2)
str_replace_nth(x = "pigpig", pattern = "pig", replacement = "gy", n = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.