我写了以下代码,但是不起作用
replacePunctuation <- function(x) {
gsub("[[:punct:]]+" , " " , x)
}
sms_data_corpus_clean <- tm_map(sms_data_corpus_clean, replacePunctuation)
**I installed and loaded the library tm
注意:目的是避免出现标点符号,如下例所示:
Are you still.....there?
使用
sms_data_corpus_clean <- tm_map(sms_data_corpus_clean, removePunctuation)
作为结果,我们将两个单词连接起来
Are you stillthere
答案 0 :(得分:0)
我认为您可以在此处使用stringr
的{{1}}函数-
str_replace
由reprex包(v0.2.0)于2018-08-23创建。