spl {easyr}R Documentation

Sample

Description

Extracts a uniform random sample from a dataset or vector. Provides a simpler API than base R. Author: Bryce Chamberlain. Tech Review: Maria Gonzalez.

Usage

spl(x, n = 10, warn = TRUE, replace = FALSE, ...)

Arguments

x

Data to sample from.

n

Number or percentage of rows/values to return. If less than 1 it will be interpreted as a percentage.

warn

Warn if sampling more than the size of the data.

replace

Whether or not to sample with replacement.

...

Other parameters passed to sample()

Value

Sample dataframe/vector.

Examples

spl( c(1:100) )
spl( c(1:100), n = 50 )
spl( iris )

[Package easyr version 0.5-8 Index]