if (require(polmineR.sampleCorpus) && require(rcqp)){
use("polmineR.sampleCorpus")
# do-it-yourself
p <- partition("PLPRBTTXT", text_date=".*", regex=TRUE)
pB <- partitionBundle(p, sAttribute="text_date")
pB <- enrich(pB, pAttribute="word")
tdm <- as.TermDocumentMatrix(pB, col="count")
# leave the counting to the as.TermDocumentMatrix-method
pB2 <- partitionBundle(p, sAttribute="text_date")
tdm <- as.TermDocumentMatrix(pB2, pAttribute="word")
# diretissima
pB3 <- as.TermDocumentMatrix("PLPRBTTXT", pAttribute="word", sAttribute="text_date")
}
Run the code above in your browser using DataLab