R tm package invalid input in 'utf8towcs'

前端 未结 14 1404
逝去的感伤
逝去的感伤 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:06

    Use the following steps:

    # First you change your document in .txt format with encoding UFT-8
    library(tm)
    # Set Your directoryExample ("F:/tmp").
    dataSet <- Corpus(DirSource ("/tmp"), readerControl=list(language="english)) # "/tmp" is your directory. You can use any language in place of English whichever allowed by R.
    dataSet <- tm_map(dataSet, tolower)
    
    Inspect(dataSet)
    

提交回复
热议问题