binaryInitState: Generate all possible initial state of community

Description Usage Arguments Value Examples

View source: R/binaryInitState.R

Description

To generate a matrix of all possible combination of species presence (1) or absence (0) as an initial state of the community. For a community of N species, there are 2^N possibilities.

Usage

1

Arguments

N

Total number of species in the community.

Value

A matrix of 2^NxN, with values 1 indicating the presence and 0 the absence of the species.

Examples

1
2
3
4
5
# Generate all possible binary initial state of a 4 species community 
mask <- binaryInitState(4)
initAbundance <- c(1, 3, 2, 4)
# Initial abundance for all 16 scenarios
allInitAbundance <- t(t(mask) * initAbundance)

yuan-yin-truly/CommunitySim documentation built on Jan. 21, 2022, 9:11 p.m.