Description Usage Arguments Value Examples
The function base::sample()
accepts either a vector of valuesto sample
from, or a single numeric value that is turned into a vector from 1 to the
input value and this range is sampled from. This has resulted in a rather
frustrating (and perplexing) error for me in the past. This function,
vsample()
always assumes the input is a vector. Therefore, if the
input vector is of length 1, that value is just returned (i.e. sampling 1
value from a vector of length 1 will always select the single element).
1 |
x |
either a vector of one or more elements from which to choose, or a positive integer. See ‘Details.’ |
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. |
For sample a vector of length size with elements drawn from either x
1 2 3 4 5 6 7 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.