I am using the tm
package to clean up some data using the following code:
mycorpus <- Corpus(VectorSource(x))
mycorpus <- tm_map(mycorpus,
The Corpus classed objected has a content
attribute accessible through get
:
library("tm")
x <- c("Hello. Sir!","Tacos? On Tuesday?!?")
mycorpus <- Corpus(VectorSource(x))
mycorpus <- tm_map(mycorpus, removePunctuation)
attributes(mycorpus)
# $names
# [1] "content" "meta" "dmeta"
#
# $class
# [1] "SimpleCorpus" "Corpus"
#
df <- data.frame(text = get("content", mycorpus))
head(df)
# text
# 1 Hello Sir
# 2 Tacos On Tuesday