Takes an input binary vector and a weight vector. Reassigns 1s randomly in proportion to vector weights.
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.
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.
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.
myColonizer <- vector_sample(speciesData=rbinom(10,1,0.5),weights=runif(10))