I am having an issue creating a DTM after running some code to clean the textual elements within a corpus.
# load data
toothbrush <- read.csv("toothbrushtext.csv", stringsAsFactors = FALSE)
# Collapse text columns
toothbrushtext <- unite(toothbrush, Text, Title.Text, Bullet.Points,
Product.Description, sep = " ")
# Place into corpus
toothbrushcorpus <- VCorpus(VectorSource(toothbrushtext$Text))
# Run various cleaning steps (only show some here)
toothbrushcorpusclean <- tm_map(toothbrushcorpus, tolower)
toothbrushcorpusclean <- tm_map(toothbrushcorpusclean, removeWords,
stopwords())
toothbrushcorpusclean <- tm_map(toothbrushcorpusclean, stemDocument)
# Create a Document term Matrix
toothbrushdtm <- DocumentTermMatrix(toothbrushcorpusclean)
# Error: Error in UseMethod("meta", x) :
no applicable method for 'meta' applied to an object of class "character"
Any idea what might be causing this?
Thanks for the help!