resample_factor: Draw uniform random (sub)sample at the group level

Description Usage Arguments Details Value See Also

View source: R/resample.R

Description

resample_factor draws a random (sub)sample (with or without replacement) of the groups or clusters identified by the fac argument.

Usage

1
resample_factor(data, param = list(fac = "class", n = Inf, replace = FALSE))

Arguments

data

a data.frame, rows represent samples

param

a list with the following components: fac is a factor variable of length nrow(data) or the name of a factor variable in data; n is a numeric value specifying the size of the subsample (in terms of groups, not observations); replace determines if resampling of groups is to be done with or without replacement.

Details

If param$replace=FALSE, a subsample of min(param$n,nlevel(data[,fac])) groups will be drawn from data. If param$replace=TRUE, the number of groups to be drawn is param$n.

Value

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

See Also

resample_strat_uniform(), sample()


sperrorest documentation built on April 1, 2018, 12:27 p.m.