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)
Dataframe to be sampled.
Non-negative integer giving the number of rows to choose.
Fraction of rows to sample.
Integer passed to set.seed
for reproducible sampling.
A data.frame