comm.sampling {comsimitv}R Documentation

Converting simulation results into site-by-species matrix

Description

Converts simulation result into site-by-species matrix of abundances, and optionally in the same step simulates random sampling with fixed number of individuals.

Usage

comm.sampling(x, type = c("full", "random"), size)

Arguments

x

community and trait data matrix produced by comm.simul function

type

Type of sampling. If type=="full" sample size equals to community size. It simply converts x into a site-by-species matrix If type=="random", it applies random sampling by calling (rrarefy) function

size

Number of individuals in the random samples. It should be smaller than number of individuals in simulated (sub)communities. Otherwise, x is converted into a site-by-species matrix without (re)sampling

Details

If type=="full" it simply converts simulation results from long to wide format. If type=="random" it randomly selects size individuals in each (sub)community and abundances in these samples are converted into site-by-species matrix format.

Value

A site-by-species matrix containing abundances.

Examples

x<-comm.simul(S=20, J=30)
str(x$final.community)

w<-comm.sampling(x$final.community,type="full")
str(w)

w.rarefied<-comm.sampling(x$final.community,type="random",size=10)
rowSums(w)
rowSums(w.rarefied)


[Package comsimitv version 0.1.5 Index]