Description Usage Arguments Value Examples
A modified sampling function based on base::sample
. It always assume that
that x
argument contains discrete values. For example, if a number 8 is given,
it will assume that 8 is the only choice it has and not assume that the choices
are number 1 to 8, like base::sample
does. This feature makes it safe when the
choices are discrete numbers and use in a programmatic way.
1 |
x |
a vector that contains value(s) that represents a choiceset. |
size |
a non-negative integer giving the number of items to choose. |
replace |
should sampling be with replacement? |
prob |
a vector of probability weights for obtaining the elements of the vector being sampled. |
returns a vector of the same type as x
with length of size
.
1 2 3 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.