Description Usage Arguments Value Author(s) Examples
View source: R/extinctSimplify.r
Computes the effect of forced extinctions on a consumer-resource matrix.
1 | extinctSimplify(m, drop, keep)
|
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 |
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.
David Kneis david.kneis@tu-dresden.de
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.