Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 为了使用tm软件包,我的语料库中的文本文件必须是什么格式?_R_Text Mining_Tm - Fatal编程技术网

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