x <- list(doc1 = c("aa", "bb", "cc", "aa", "b"),
doc2 = c("bb", "bb", "dd", ""),
doc3 = character(),
doc4 = c("cc", NA),
doc5 = character())
dtm <- document_term_matrix(x)
dtm_sample(dtm, size = 2)
dtm_sample(dtm, size = 3)
dtm_sample(dtm, size = 2)
dtm_sample(dtm, size = 8, replace = TRUE)
dtm_sample(dtm, size = 8, replace = TRUE, prob = c(1, 1, 0.01, 0.5, 0.01))
Run the code above in your browser using DataLab