I am using the tm
package to clean up some data using the following code:
mycorpus <- Corpus(VectorSource(x))
mycorpus <- tm_map(mycorpus, removePunctuation)
I then want to convert the corpus back into a data frame in order to export a text file that contains the data in the original format of a data frame. I have tried the following:
dataframe <- as.data.frame(mycorpus)
But this returns an error:
"Error in as.data.frame.default.(mycorpus) : cannot coerce class "c(vcorpus, > corpus")" to a data.frame
How can I convert a corpus into a data frame?