I am new to text processing with R. I'm trying the simple code below
library(RTextTools)
texts <- c("This is the first document.", "This is the second file.", "This is the third text.")
matrix <- create_matrix(texts,ngramLength=3)
which is one of the answers in the question Finding 2 & 3 word Phrases Using R TM Package
However, it gives an error Error in FUN(X[[2L]], ...) : non-character argument
instead.
I can generate a document term matrix when I drop the ngramLength
parameter, but I do need to search for phrases of certain word length. Any suggestions of alternative or corrections?