Learn R Programming

ATNr (version 1.1.0)

create_niche_model: Create a food web based on the niche model

Description

Function to generate a food web based on the niche model (Williams and Martinez, 2000) based on the number of species and connectance. Corrections from Allesina et al. (2008) are used.

Usage

create_niche_model(S, C)

Value

A (square) matrix with zeros (no interaction) and ones (species j consume species i).

Arguments

S

integer, number of species.

C

numeric, connectance i.e. the number of realized links over the all possible links.

Details

If at least one species has not resource or consumer (i.e. it is an isolated species), another food web is generated, until a maximum of 100 iterations.

References

Williams, R. J., & Martinez, N. D. (2000). Simple rules yield complex food webs. Nature, 404(6774), 180-183.

Allesina, S., Alonso, D., & Pascual, M. (2008). A general model for food web structure. science, 320(5876), 658-661.

Examples

Run this code
set.seed(123)
web_niche <- create_niche_model(30, .1)
image(t(web_niche))

Run the code above in your browser using DataLab