I'm trying to create a TermDocumentMatrix using tm package, but seem to have encountered difficulties.
The input:
trainDF<-as.matrix(list("I'm going home", "trying to fix this", "when I go home"))
Goal - creating a TDM from the input: (not all controls parameters listed below)
control <- list(
weight= weightTfIdf,
removeNumbers=TRUE,
removeStopwords=TRUE,
removePunctuation=TRUE,
stemWords=TRUE,
maxWordLength=maxWordL,
bounds=list(local=c(minDocFreq, maxDocFreq))
)
tdm<- TermDocumentMatrix(Corpus(DataframeSource(trainDF)),control = control)
The error I get:
Warning message:
In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL'
And the tdm object is empty. Any ideas?
list(weight= weightTfIdf, removeNumbers=TRUE, removeStopwords=TRUE, removePunctuation=TRUE, stemWords=TRUE)works. - Tyler Rinker