This is a wrapper around sample
to make it
easy to select random rows from a table. Supports either integer
(sampleSize
) or fractional (sampleFraction
) row sampling.
For reproducible debugging, specify seed
.
If both sampleSize
and sampleFraction
are specified,
sampleSize
takes precedence.
Specifying sampleSize
greater than the number of rows in the
dataframe or sampleFraction > 1
will use all rows.
.sample(data, sampleSize = NULL, sampleFraction = NULL, seed = NULL)
data | Dataframe to be sampled. |
---|---|
sampleSize | Non-negative integer giving the number of rows to choose. |
sampleFraction | Fraction of rows to sample. |
seed | Integer passed to |
A data.frame