Your corpus is really just a character vector with some extra attributes. So it's best to convert it to character, then you can save that to a data.frame like so:
library(tm)
x <- c("Hello. Sir!","Tacos? On Tuesday?!?")
mycorpus <- Corpus(VectorSource(x))
mycorpus <- tm_map(mycorpus, removePunctuation)
dataframe <- data.frame(text=unlist(sapply(mycorpus, `[`, "content")),
stringsAsFactors=F)
which returns
text
1 Hello Sir
2 Tacos On Tuesday
UPDATE: With newer version of tm
, they seem to have updated the as.list.SimpleCorpus
method which really messes with using sapply
and lapply
. Now I guess you'd have to use
dataframe <- data.frame(text=sapply(mycorpus, identity),
stringsAsFactors=F)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…