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

View source: R/resample.R

resample_factorR Documentation

Draw uniform random (sub)sample at the group level

Description

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

Usage

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()


pat-s/sperrorest documentation built on June 6, 2023, 7:51 a.m.