我有以下数据:
text <- c("@_rpg_17 little league travel tourney. These parents about to be wild.",
"@auscricketfan @davidwarner31 yes WI tour is coming soon", "@keralatourism #favourite #destination #munnar #topstation https://t.co/sm9qz7Z9aR",
"@NWAWhatsup tour of duty in NWA considered a dismal assignment? Companies send in their best ppl and then those ppl don't want to leave",
"Are you Looking for a trip to Kerala? #Kerala-prime tourist attractions of India.Visit:http://t.co/zFCoaoqCMP http://t.co/zaGNd0aOBy",
"Are you Looking for a trip to Kerala? #Kerala, God's own country, is one of the prime tourist attractions of... http://t.co/FLZrEo7NpO")
以下是代码:
library(tm)
myCorpus <- Corpus(VectorSource(text))
myCorpus <- tm_map(myCorpus, tolower)
myCorpus <- tm_map(myCorpus, removePunctuation)
myCorpus <- tm_map(myCorpus, removeNumbers)
removeURL <- function(x) gsub("http[[:alnum:]]*", "", x)
myCorpus <- tm_map(myCorpus, removeURL)
myStopwords <- c(stopwords('english'), "available", "via")
myCorpus <- tm_map(myCorpus, removeWords, myStopwords)
myCorpusCopy <- myCorpus
myCorpus <- tm_map(myCorpus, stemDocument)
myTdm <- TermDocumentMatrix(myCorpus, control=list(wordLengths=c(3,Inf)))
这曾经在我的Windows机器中完美地工作。不确定这是否是因为我目前使用的mac。我在主题行中得到了上面给出的错误。在其他情况下,我得到其他错误:
Error in UseMethod("meta", x) : no applicable method for 'meta' applied to an object of class "character"
In addition: Warning message:In mclapply(unname(content(x)), termFreq, control) :all scheduled cores encountered errors in user code
我使用R版本3.2.0(2015-04-16) - &#34; Full of Ingredients&#34;,R-Studio版本0.98.1103,Mac OS X Yosemite 10.10.3,库(tm)版本0.6 - 1.我在代码中尝试了以下更改:
和堆栈溢出中给出的其他解决方案。似乎没什么用。不知道如何解决?