resample_uniform {sperrorest}R Documentation

Draw uniform random (sub)sample

Description

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

Usage

resample_uniform(data, param = list(n = Inf, replace = FALSE))

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

# Muenchow et al. (2012), see ?ecuador
d <- resample_uniform(ecuador, param = list(strat = "slides", n = 200))
# == 200
sum(d$slides == "TRUE")

[Package sperrorest version 3.0.5 Index]