R 为了使用tm软件包,我的语料库中的文本文件必须是什么格式?
我目前正在处理一个平面文本文件,它实际上只是一个大文本副本,粘贴到记事本中。我在桌面上指定了一个文件夹作为我的语料库,用作我的工作目录R 为了使用tm软件包,我的语料库中的文本文件必须是什么格式?,r,text-mining,tm,R,Text Mining,Tm,我目前正在处理一个平面文本文件,它实际上只是一个大文本副本,粘贴到记事本中。我在桌面上指定了一个文件夹作为我的语料库,用作我的工作目录 #Map a directory to the corpus location on the desktop cname<-file.path("~", "Desktop", "corpus" ) #Begin text processing docs<-Corpus(DirSource(cname))
#Map a directory to the corpus location on the desktop
cname<-file.path("~", "Desktop", "corpus" )
#Begin text processing
docs<-Corpus(DirSource(cname))
summary(docs)
此错误是否与文档的格式有关?要使用tm软件包,格式化平面文本文件的正确方法是什么?这似乎是
cname
的问题。检查它是否确实是您期望的目录(并且~
表示您认为它的功能)。经过一些研究,它似乎是cm最新版本的一个bug。这一联系已有三年历史。
Error in DirSource("cname/") : empty directory