Given
test<-"Low-Decarie, Etienne"
I wish to replace all punctuation with space
gsub(pattern="[:punct:]", x=test, replacement=" ")
but this produces
"Low-De arie, E ie e"
where no punctuation is replaced and apparently random letters are removed (though they may be associated with punctation as t for tab and n for next line).
Fellow MontReal user here.
Several options, sames results.
In R Base, just double the brackets
Package
stringrhas functionstr_replace_allthat does that.Or keep only letters