我使用代码
从一些挖掘的推文中创建了一个字符向量tweets_text <- sapply(tweets, function(x) x$getText(x))
我尝试使用代码
从字符向量源创建语料库my_corpus <- Corpus(VectorSource(tweets_text)
但我一直收到错误
Error in as. vector(x, "character"):
cannot coerce type 'closure' to vector of type 'character'
其中一条推文的dput(head(tweets))
以
structure(function ()
text, mayCall = character(0), name = "getText", refClassName = "status", superClassMethod = "", class = structure("refMethodDef", package = "methods")))` and str(tweets) is ` $ :Formal class 'refMethodDef' [package "methods"] with 5 slots
.. ..@ .Data :function ()
.. ..@ mayCall : chr(0)
.. ..@ name : chr "getText"
.. ..@ refClassName : chr "status"
.. ..@ superClassMethod: chr ""