Learn R Programming

quanteda (version 0.9.9-50)

sample: randomly sample documents or features

Description

Deprecated function framework for randomly sampling from a corpus or dfm object. Use corpus_sample or dfm_sample instead

Usage

sample(x, size, replace = FALSE, prob = NULL, ...)

# S3 method for default sample(x, size, replace = FALSE, prob = NULL, ...)

# S3 method for corpus sample(x, ...)

# S3 method for dfm sample(x, ...)

Arguments

x
a corpus or dfm object whose documents or features will be sampled
size
a positive number, the number of documents to select
replace
Should sampling be with replacement?
prob
A vector of probability weights for obtaining the elements of the vector being sampled.
...
unused

See Also

corpus_sample, dfm_sample