R: Got problems in reading text file

自闭症网瘾萝莉.ら 提交于 2019-12-02 03:50:17

Following is what you needed to do:

  1. Change the article<-Corpus(DirSource(directory=s.dir,encoding="ANSI")) to following:

article <- VCorpus(DirSource(directory = s.dir), readerControl = list(reader=readPlain))

  1. In cleanCorpus function, change the corpus.tmp <- tm_map(corpus.tmp, tolower) to following:

corpus.tmp <- tm_map(corpus.tmp, content_transformer(tolower))

Pay attention to usage of "content_transformer" function.

Once done with above, you should be able to fix the problem.

Go to "cran.r-project.org/web/packages/tm/index.html"; and download and install the old version of tm, and wait until the bug is fixed.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!