trinker / qdap

Quantitative Discourse Analysis Package: Bridging the gap between qualitative data and quantitative analysis
http://cran.us.r-project.org/web/packages/qdap/index.html
175 stars 44 forks source link

Store and retrieve MMetaData from Corpus objects when converting to data.frame #156

Closed trinker closed 10 years ago

trinker commented 10 years ago

Consider the following:

docs <- data.frame(docs = c("This is a text.", "This another one."),
                   row.names = c("Text 1", "Text 2"), more=c("A", "B"))
(ds <- DataframeSource(docs[,-2, drop=FALSE]))
inspect(Corpus(ds))
x <- Corpus(ds)

attributes(x)[["DMetaData"]] <- data.frame(attributes(x)[["DMetaData"]], mtcars[1:2, ])

attributes(x)
meta(x)

This could be used to make tm_corpus2df and df2tm_corpus more useful.