sample
works for the documents and their associated
document-level variables.
corpus_sample(x, size = ndoc(x), replace = FALSE, prob = NULL, ...)
size
, drawn
from the corpus x
. The returned corpus object will contain all of
the meta-data of the original corpus, and the same document variables for
the documents selected.
sample
# sampling from a corpus
summary(corpus_sample(data_corpus_inaugural, 5))
summary(corpus_sample(data_corpus_inaugural, 10, replace=TRUE))
Run the code above in your browser using DataLab