Skip to contents

The resample function randomly selects elements from a vector with replacement.

Usage

resample(x, ...)

Arguments

x

A vector from which elements will be sampled.

...

Additional arguments to be passed to sample.int.

Value

A vector containing a random sample of elements from x, with replacement.

Details

This function is a wrapper around the sample.int function in R, providing a more concise way to resample elements from a vector.

See also

Examples

# Resample elements from a vector
x <- c(1, 2, 3, 4, 5)
resample(x, 3)
#> [1] 5 2 1