Function sample, given the first parameter
x is a single integer value, samples from the set \(1,\ldots,x\).
This behavior might be undesirable when sample is embedded
into routines and x is a variable.
This function remedies this issue. If x is a number it returns x
size-times.
sample2(x, size, replace = FALSE, ...)
| 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? |
| ... | [any] |
A vector.