extinctSimplify: Simplify a consumer-resource matrix

Description Usage Arguments Value Author(s) Examples

View source: R/extinctSimplify.r

Description

Computes the effect of forced extinctions on a consumer-resource matrix.

Usage

1

Arguments

m

Square matrix filled with 0 and 1. Column names represent consumers, row names represent ressources. Row and column names must be identical. A value of 1 indicates that the consumer in the respective column feeds on the resource in the respective row.

drop

Vector of character strings defining the rows and columns to be removed from the food web (forced extinctions).

keep

Vector of character strings defining the rows and columns to be always kept in the system. Typically, these represent primary producers. The elements in keep should not be present in drop as well.

Value

A square matrix with less rows and columns than the input matrix m. The result matrix reflects both the forced extinctions (specified in drop) and the secondary extinctions being triggered by the forced ones.

Author(s)

David Kneis david.kneis@tu-dresden.de

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# A simple aquatic food consisting of algae, zooplankton
# planktivorous fish and a top predator.

m <- rbind(
  algae =  c(0,1,1,0,0,0),
  zoopl1 = c(0,0,0,1,1,0),
  zoopl2 = c(0,0,0,0,1,0),
  fish1 =  c(0,0,0,0,0,1),
  fish2 =  c(0,0,0,0,0,1),
  top =    c(0,0,0,0,0,0)
)
colnames(m) <- rownames(m)
print("Original food web:")
print(m)

m2 <- extinctSimplify(m,
  drop=c("zoopl1","fish2"), keep=c("algae"))
print("Resulting food web:")
print(m2)

dkneis/knut documentation built on Jan. 7, 2020, 4:27 a.m.