Skip to contents

This function performs resampling of the elements in a vector `x`. It randomly shuffles the elements of `x` and returns a vector of the resampled elements. If `x` is empty, it returns `NA_integer_`.

Usage

resample(x, ...)

Arguments

x

A vector containing the elements to be resampled. If `x` is empty, the function will return `NA_integer_`.

...

Additional arguments passed to `sample.int`, such as `size` for the number of items to sample and `replace` indicating whether sampling should be with replacement.

Value

A vector of resampled elements from `x`. If `x` is empty, returns `NA_integer_`. The length and type of the returned vector depend on the input vector `x` and the additional arguments provided via `...`.