I have a list and I want to replace the occurrence of one with count below
str_list <- c("2","1","2","1")
str_replace_all(str_list,"1",c("1:once","1:twice"))
gives output
[1] "2" "1:twice" "2" "1:twice"
but it should give
[1] "2" "1:once" "2" "1:twice"