R tm package invalid input in 'utf8towcs'

前端 未结 14 1415
逝去的感伤
逝去的感伤 2020-11-29 01:47

I\'m trying to use the tm package in R to perform some text analysis. I tied the following:

require(tm)
dataSet <- Corpus(DirSource(\'tmp/\'))
dataSet <         


        
14条回答
  •  醉话见心
    2020-11-29 02:15

    Chad's solution wasn't working for me. I had this embedded in a function and it was giving an error about iconv neededing a vector as input. So, I decided to do the conversion before creating the corpus.

    myCleanedText <- sapply(myText, function(x) iconv(enc2utf8(x), sub = "byte"))
    

提交回复
热议问题