How transform a list into a corpus in r?

这一生的挚爱 提交于 2019-12-02 03:52:29

问题


In this question I asked how to split a huge dataframe to create a corpus. Thanks to the answer I was able to create a list from a dataframe. My problem was still obtaining a corpus from the list I created in order to do some text mining and cluster the data according to the search term.


回答1:


To solve this problem I just applied the as.VCorpus function of the tm package to the list I created before:

new_corpus <- as.VCorpus(new_list)

Check if the new object is a corpus:

class(new_corpus)
[1] "VCorpus" "Corpus" 

I thus created a "volatile corpus". As written in the R documentation:

A volatile corpus is fully kept in memory and thus all changes only affect the corresponding R object.



来源:https://stackoverflow.com/questions/34061912/how-transform-a-list-into-a-corpus-in-r

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