看板 R_Language 關於我們 聯絡資訊
[問題類型]: 程式諮詢(我想用R 做某件事情,但是我不知道要怎麼用R 寫出來) [軟體熟悉度]: 入門(寫過其他程式,只是對語法不熟悉) [問題敘述]: 我想要用R做text mining,但在stopwords這個步驟的時候出錯 Error in UseMethod("tm_map", x) : no applicable method for 'tm_map' applied to an object of class "list" [程式範例]: #讀進一個檔案 data = readLines("test/test.txt") #進行中文斷詞 insertWords(toTrad(iconv(c("民進黨"), "big5", "UTF-8"), rev=TRUE))#增加詞彙 segment.options(isNameRecognition = TRUE)#增加人名辨識 #將文章分詞 data.seg = segmentCN(data, nature=FALSE) #stop words myStopWords = toTrad(stopwordsCN()) data.seg= tm_map(data.seg, removeWords, myStopWords) #清除停用字符 ----------->最後一步出現Error in UseMethod("tm_map", x) : no applicable method for 'tm_map' applied to an object of class "list" [環境敘述]: R version 3.2.0 (2015-04-16) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 8 x64 (build 9200) -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.218.5.190 ※ 文章網址: https://www.ptt.cc/bbs/R_Language/M.1435827664.A.77D.html
Edster: 這是哪個library, 還有你知道R中的list和字串character 07/02 19:05
Edster: 的差異應該就能了解那段英文的意思。 07/02 19:06
penolove: unlist 應該就能解了 07/03 02:24
shihs: 是tm這個library 07/08 14:30
shihs: unlist還是無法...錯誤變成是"character" 07/08 14:31