View source: R/other_functions.R
sampled | R Documentation |
If only one value is given in sample
function, it chooses a value between 1 and the number you specified. The redefined sample function solves this problem.
sampled(x, size, replace = FALSE, prob = NULL)
x |
either a vector of one or more elements from which to choose, or a positive integer. |
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 or from the integers 1:x.
For more information see sample
.
sampled(2, 1)
sampled(1:5, 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.