safe_sample | R Documentation |
Similar to standard sample
function. Safe sample function considering the special case of an integer vector with only one element.
safe_sample(x, size, replace = FALSE, prob = NULL)
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: |
A vector with the elements chosen.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.