Adapted directly from the
sample help file.
resampleZeroProof is a version that works even if sum of all
probabilities passed to
sample.int is zero.
This causes an error in
resample(x, ...) resampleZeroProof(spreadProbHas0, x, n, prob)
either a vector of one or more elements from which to choose, or a positive integer. See ‘Details.’
a positive number, the number of items to choose from. See ‘Details.’
a vector of probability weights for obtaining the elements of the vector being sampled.
Intended for internal use only.