简体   繁体   English

如何在R中保存列表?

[英]How to save a list of lists in R?

I stored in a list a number of web pages I collected with rvest::read_html . 我在列表中存储了一些我用rvest::read_html收集的网页。 Now I would like to save this big list of web pages for later use (so that I don't have to scrape the data again). 现在我想保存这个大的网页列表供以后使用(这样我就不必再次删除数据了)。

I tried saveRDS , but the resulting file is only 1kb and reading the data back results in a crash. 我尝试了saveRDS ,但生成的文件只有1kb,读取数据会导致崩溃。 I suspect that the dynamic nature of the object I'm trying to save gets in the way. 我怀疑我试图保存的对象的动态性质妨碍了我。

What would be the best way to save my data? 保存数据的最佳方法是什么? Many thanks in advance for you help! 非常感谢您的帮助!

You can convert the text as a corpus of text and write them. 您可以将文本转换为文本语料库并进行编写。 The easiest is from package tm in R. Check this https://cran.r-project.org/web/packages/tm/tm.pdf for more details. 最简单的是来自R中的包tm。有关详细信息,请访问https://cran.r-project.org/web/packages/tm/tm.pdf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM