These functions convert data frame to corpus objects
same as those constructed with
corpus
, VCorpus
,
and PCorpus
. The list-column
comment
of the original post data frame is dropped
for not complicating the data structure of the corpus.
post2qcorp(df, ...) post2tmcorp(df, PCorpus = FALSE, ...)
df | Data frame. A data frame generated by
|
---|---|
... | Additional arguments passed on to
|
PCorpus | Logical. Whether to contruct corpus with
|
library(quanteda) post_df <- example_posts() post_corp <- post2qcorp(post_df) summary(post_corp) library(tm) post_df <- example_posts() post_corp <- post2tmcorp(post_df) inspect(post_corp) meta(post_corp, "author")