## Usage

vector_sample(speciesData, weights)

## Arguments

- speciesData
- binary vector representing species presences and
absences.
- weights
- a vector of non-negative read numbers representing
probabilistic weights for species occurrencs of the same length
as speciesData.

## Value

Returns a re-ordered binary vector in which the occurrences
are placed in cells with probabilities proportional to values given
in weights.

## Description

Takes an input binary vector and a weight vector.
Reassigns 1s randomly in proportion to vector weights.

## Details

This function takes an input vector of binary presence-absence
values and a vector of non-negative probability weights. Both vectors
must be of identical length.

## Note

Several of the randomization algorithms use this function
to assign species occurrences with probabilities that reflect
species or site differences. It is an effective method for
conditioning the marginal probabilities of a null matrix on
independent measurements of site or species characteristics.

## References

Gotelli, N.J., G.R. Graves, and C. Rahbek. 2010. Macroecological
signals of species interactions in the Danish avifauna. Proceedings of the
National Academy of Sciences, U.S.A. 107: 530-535.

## Examples

myColonizer <- vector_sample(speciesData=rbinom(10,1,0.5),weights=runif(10))