sample_replace: Sample considering reference values
Description
Similar to standard sample
function. The values in ref
can be chosen or not,
according to original
.
Usage
sample_replace(x, size, original, ref)
Value
A vector with the elements chosen from x
.
Arguments
- x
a vector with the alternatives to choose.
- size
an integer with the number of elements to select from x
.
- original
a boolean indicating if the values in ref
can be chosen.
- ref
a vector with n
reference values.