Last chance! 50% off unlimited learning
Sale ends in
powered by
Extracts a uniform random sample from a dataset or vector. Provides a simpler API than base R. Author: Bryce Chamberlain. Tech Review: Maria Gonzalez.
spl(x, n = 10, warn = TRUE, replace = FALSE, seed = NULL, ...)
Sample dataframe/vector.
Data to sample from.
Number or percentage of rows/values to return. If less than 1 it will be interpreted as a percentage.
Warn if sampling more than the size of the data.
Whether or not to sample with replacement.
Set a seed to allow consistent/replicable sampling.
Other parameters passed to sample()
spl( c(1:100) ) spl( c(1:100), n = 50 ) spl( iris )
Run the code above in your browser using DataLab