Description Usage Arguments Examples
This version of the sample function removes the feature where x is an integer of length 1
sampling via sample takes place from 1:x. This can bring unexpected behaviour
as mentioned in the documentation of base::sample()
.
1 | sample_choice(x, size = 1, replace = FALSE, prob = NULL)
|
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. |
1 2 3 | sample_choice(7, 10, replace = TRUE) # equipvalent to rep(7, 10)
sample_choice(7, 1)
sample_choice(7) # which is equipvalent to the above
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.