The resample
function randomly selects elements from a vector 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.
Examples
# Resample elements from a vector
x <- c(1, 2, 3, 4, 5)
resample(x, 3)
#> [1] 5 2 1