Description Usage Arguments Value See Also Examples
Replace all occurance of 'pattern'
in all non numeric columns from a tbl.
1 | tbl_replace_string(tbl, pattern, replacement)
|
tbl |
a tbl. |
pattern |
pattern to look for. Will be passed to argument |
replacement |
a character vector of replacements. Will be passed to argument |
a tbl.
stringr::str_replace_all()
1 2 3 4 5 6 7 8 9 10 11 | ## Not run:
tbl <- tibble::tibble(x = c(letters[1:5] ,letters[1:5] ) ,
y = c(LETTERS[1:5],LETTERS[1:5]) , z = 1:10 )
tbl %>% tbl_replace_string(pattern = "a" , replacement = "a_changed")
tbl %>% tbl_replace_string("[aeiou]", toupper)
tbl %>% tbl_replace_string("([aeiou])", "")
tbl %>% tbl_replace_string(c("a", "e", "i"), "-")
tbl %>% tbl_replace_string("b", NA_character_)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.