Skip to contents

This function defines the cluster variables, then resamples from the unique clusters N times, where N is the number of unique clusters. Observations within each cluster are also resampled.

Usage

boot_cluster(dat, design.vars, cluster.vars, out.folder, i)

Arguments

dat

The original data to be bootstrapped (does not contain a variable named "cluster").

design.vars

An unquoted vector of column names used to construct a cluster. An unquoted vector of column names.

cluster.vars

An unquoted vector of column names used to construct a cluster. Clusters just identify groups of observations that should be sampled together. Not all clusters may appear in a bootstrapped data. If it's essential that a grouping variable be

out.folder

An optional quoted string that gives the path to an existing folder where bootstrapped data objects should be written, if written to file. If not provided, an object or list of objects is returned in the environement.

i

a counter that will be written to the name of each bootstrapped data (e.g bootdat_1.rds, dat_2.rds) if data objects are written to file

Value

writes file(s) of bootstrapped data to a folder, if specified, or as a list to an object in the local environment