sample2 | R Documentation |
The standard sample function in R samples from n numbers when x = n. This is unwanted behavior when the size of the vector to sample from changes dynamically. This is corrected in sample2
sample2(x, size, replace = FALSE, prob = NULL)
x |
A vector of one or more elements |
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. |
sam |
A vector of length |
Rampal S. Etienne
sample(x = 10,size = 5,replace = TRUE)
sample2(x = 10,size = 5,replace = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.