Here is simple example
library(dplyr)
library(stringr)
> dataf <- data_frame(text = c('this is a pip||e |' ,
+ 'this is |||'))
> dataf
# A tibble: 2 x 1
text
<chr>
1 this is a pip||e |
2 this is |||
I want to replace all the pipes in the data with an empty string. Basically I want them to disappear. However, I am only able to get rid of one of them at a time:
> dataf %>% mutate(text = str_replace(text, '\\|+', ""))
# A tibble: 2 x 1
text
<chr>
1 this is a pipe |
2 this is
What is wrong here? Thanks!