sample {ff} | R Documentation |
sample
takes a sample of the specified size from the elements
of x
using either with or without replacement.
sample(x, size, replace = FALSE, prob = NULL)
x |
Either a (numeric, complex, character or logical) vector of more than one element from which to choose, or a positive integer. |
size |
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. |
See the corresponding help file of sample
for further details and examples.
The function sample
is set up as a generic function; the sample
function now becomes the default method.