我正在尝试使用 R 中的 TM 包清理我的文本语料库,但是我不断收到此错误:
no applicable method for 'removePunctuation' applied to an object of class "data.frame"
我的数据由从文本文件中读取的聊天日志组成,在 R 中如下所示:
V1
1 In the process
2 Sorry I had to step away for a moment.
3 I am getting an error page that says QB is currently unavailable.
4 That link gives me the same error message.
我用:
tdm <- TermDocumentMatrix(text,
control = list(removePunctuation = TRUE,
stopwords = TRUE))
但我收到此错误:
Error in UseMethod("TermDocumentMatrix", x) :
no applicable method for 'TermDocumentMatrix' applied to an object of class "data.frame"
似乎我不应该将数据框输入到函数中,但我还能怎么做呢?
谢谢