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

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 201867

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>