Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 204771

stringr str_replace on multiple patterns and replacements?

$
0
0

I tried

> str_replace("abcdef", c("b", "d"), c(b="B", d="D"))
[1] "aBcdef""abcDef"

hoping for

[1] "aBcDef"

How can we replace each pattern with a specific replacement with one function call to stringr::str_replace?


Viewing all articles
Browse latest Browse all 204771

Trending Articles