How to save an R Corpus to disk

强颜欢笑 提交于 2019-12-11 04:09:35

问题


I have a large R Corpus object, using the tm package, made up of millions of small documents.

How do I save that to disk as a single text file for use with other programs (such as word2vec)?

I tried

writeCorpus(myCorpus)

but that wrote out a million tiny text files that blew up my Mac!

I'm not very proficient in R, so any help on how to do this would be much, much appreciated. Thank you!


回答1:


Try :

writeLines(as.character(mycorpus), con="mycorpus.txt")

But I don't know if it will be efficient with a million documents



来源:https://stackoverflow.com/questions/22020575/how-to-save-an-r-corpus-to-disk

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