我正在尝试从字符串向量中删除非字母字符.我认为[:punct:]分组会覆盖它,但它似乎忽略了+.这属于另一组角色吗?
library(stringi)
string1 <- c(
"this is a test"
,"this, is also a test"
,"this is the final. test"
,"this is the final + test!"
)
string1 <- stri_replace_all_regex(string1, '[:punct:]', ' ')
string1 <- stri_replace_all_regex(string1, '\\+', ' ')
Run Code Online (Sandbox Code Playgroud)