1
我正在嘗試對推文進行情感分析。雖然這樣做的話的前處理,創造一個矩陣,我得到了以下錯誤:r中的詞幹:缺失值
Error in if (any(lens > lim)) stop("There is a limit of ", lim, "characters on the number of characters in a word being stemmed") :
missing value where TRUE/FALSE needed
從14215個鳴叫,我煮下來到產生錯誤的具體鳴叫,但都沒有得到線索如何防止再次發生此錯誤。 由於其出錯的鳴叫是(和代碼重現錯誤):
library(RTextTools)
tweet<-"demonio leg edge sexy we get it u vape PLEASE COME TO NA SOON I HAVE A LUCIEL READY FOR U dominos"
all_tweets= create_matrix(tweet, language="english", minWordLength = 3,
removeStopwords=TRUE, removeNumbers=TRUE, # we can also removeSparseTerms
stemWords=TRUE,removePunctuation = TRUE,removeSparseTerms = 0)
首先,我想理解的錯誤 - 爲什麼會發生,然後我的願望是這將使我的方法防止發生此錯誤 - 通過選擇和刪除這樣的推文或通過編輯我的create_matrix函數?
嗨,哪個版本你有(R/RTextTools包)。在Windows 64,R 3.2.2和RTextTools 1.4.2上,我無法在您提供的文本上重現錯誤。 –
我正在使用R版本3.3.0和RTextTools 1.4.2 – user3109578
也許是區域設置或編碼的問題。 @lukeA建議似乎也是一種可能性。無論如何,你的代碼在這裏很有魅力。 –