safe_sample {noisemodel} | R Documentation |
Safe sample function
Description
Similar to standard sample
function. Safe sample function considering the special case of an integer vector with only one element.
Usage
safe_sample(x, size, replace = FALSE, prob = NULL)
Arguments
x |
a vector with the alternatives to choose. |
size |
an integer with the number of elements to select from |
replace |
a boolean indicating if the elements should be chosen with replacement (default: |
prob |
a double vector with the probability associated to each element (default: |
Value
A vector with the elements chosen.
[Package noisemodel version 1.0.2 Index]