# NOT RUN {
use("polmineR")
# enriching partition_bundle explicitly
tdm <- partition("GERMAPARLMINI", date = ".*", regex = TRUE) %>%
partition_bundle(s_attribute = "date") %>%
enrich(p_attribute = "word") %>%
as.TermDocumentMatrix(col = "count")
# leave the counting to the as.TermDocumentMatrix-method
tdm <- partition_bundle("GERMAPARLMINI", s_attribute = "date") %>%
as.TermDocumentMatrix(p_attribute = "word", verbose = FALSE)
# obtain TermDocumentMatrix directly (fastest option)
tdm <- as.TermDocumentMatrix("GERMAPARLMINI", p_attribute = "word", s_attribute = "date")
dtm <- corpus("REUTERS") %>%
split(s_attribute = "id") %>%
as.TermDocumentMatrix(p_attribute = "word")
# }
Run the code above in your browser using DataLab