I have the following code but I get an error when trying to create a document term matrix: (originally I had the data in a csv file with one column, and did read.csv, but for purposes of replication I created a data frame below)
library(tm)
TEXTS<- as.data.frame(c("I am a cat person", "I like both cats and dogs"), stringsAsFactors = FALSE)
docs<-VCorpus(VectorSource(TEXTS))
docs <- tm_map(docs, removePunctuation)
docs <- tm_map(docs, removeNumbers)
docs <- tm_map(docs, content_transformer(tolower), lazy = TRUE)
docs <- tm_map(docs, PlainTextDocument, lazy = TRUE)
docs <- tm_map(docs, removeWords, stopwords("english"), lazy = TRUE)
library(SnowballC)
docs <- tm_map(docs, stemDocument, language = meta(docs, "english"), lazy = TRUE)
dtm <- DocumentTermMatrix(docs)
this is the error I get from the last line:
Error in stemDocument.PlainTextDocument(x, ...) :
promise already under evaluation: recursive default argument reference or earlier problems?
In addition: Warning message:
In stemDocument.PlainTextDocument(x, ...) :
restarting interrupted promise evaluation
What can I do? thanks