[R] n-gram error with packages tau, tm, RTextTools
email
email8889 at gmail.com
Sun Oct 5 17:40:11 CEST 2014
Hi:
I am trying to compute n-grams using package tm and tau with following code:
tokenize_ngrams <- function(x, n=3)
return(rownames(as.data.frame(unclass(textcnt(x,method="string",n=n)))))
texts <- c("This is the first document.", "This is the second file.",
"This is the third text.")
corpus <- Corpus(VectorSource(texts))
matrix <- DocumentTermMatrix(corpus,control=list(tokenize=tokenize_ngrams))
And getting following error
Error in FUN(X[[2L]], ...) : non-character argument
also getting same error using the RTextTools package.
Any solution?
Best regards:
John
More information about the R-help
mailing list