Learn R Programming

EcoSimR (version 0.1.0)

vector_sample: Vector Sample Function

Description

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

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.

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.

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.

See Also

sim10 randomization algorithm.

Examples

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

Run the code above in your browser using DataLab