resample_uniform: Draw uniform random (sub)sample

Description Usage Arguments Details Value See Also Examples

View source: R/resample.R

Description

resample_uniform draws a random (sub)sample (with or without replacement) from the samples in data.

Usage

1

Arguments

data

a data.frame, rows represent samples

param

a list with the following components: n is a numeric value specifying the size of the subsample; replace determines if sampling is with or without replacement

Details

If param$replace=FALSE, a subsample of size min(param$n,nrow(data)) will be drawn from data. If param$replace=TRUE, the size of the subsample is param$n.

Value

a data.frame containing a subset of the rows of data.

See Also

resample_strat_uniform(), sample()

Examples

1
2
3
4
data(ecuador) # Muenchow et al. (2012), see ?ecuador
d <- resample_uniform(ecuador, param = list(strat = 'slides', n = 200))
nrow(d) # == 200
sum(d$slides == 'TRUE')

sperrorest documentation built on Nov. 17, 2017, 4:28 a.m.