sample_unique: Sample from Unique Values of Data

View source: R/randomize.R

sample_uniqueR Documentation

Sample from Unique Values of Data

Description

sample_unique() samples from the unique values in the input. If size is greater than or equal to the number of input observations, it ensures that each observations is present at least once. All sampling steps are uniform random, but the output will only be uniform random for n <= number of observations, or n >> number of observations. This is due to the switch from sampling with replacement to sampling without replacement once the sample size is larger than the number of observations.

Usage

sample_unique(.x, n)

Arguments

.x

The data to sample

n

The number of samples to return

Value

The shuffled input and additional observations


jesse-smith/coviData documentation built on Jan. 14, 2023, 11:08 a.m.