sampleV {SpaDES.tools} | R Documentation |
Resample
Description
A version of sample that doesn't have awkward behaviour when length(x) == 1
.
Vectorized version of sample
using Vectorize
Usage
sampleV(x, size, replace = FALSE, prob = NULL)
Arguments
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. |
Details
Intended for internal use only. size
is vectorized.
Value
A random permutation, as in sample
, but with size
vectorized.
[Package SpaDES.tools version 2.0.7 Index]