Learn R Programming

cheddar (version 0.1-639)

TrophicChainsStats: Trophic chains statistics

Description

Computes simple statistics about every trophic chain in a food web.

Usage

TrophicChainsStats(community)

Value

A list containing:

chain.lengths

The number of nodes in each trophic chain.

node.pos.counts

A matrix of NumberOfNodes rows and 1+max(chain.lengths) columns. Elements are the number of chains in which a node appear in that position.

Arguments

community

an object of class Community.

Author

Lawrence Hudson

Details

Enumerates every trophic chain in the food-web and returns a list object containing some simple statistics. If your analysis requires only simple statistics about trophic chains then this function is more suitable than TrophicChains because it is faster and requires less memory.

See Also

TrophicChains, NumberOfNodes, IsolatedNodes, BasalNodes, IntermediateNodes, TopLevelNodes

Examples

Run this code
data(TL84)
chain.stats <- TrophicChainsStats(TL84)

# The length of every chain
length(chain.stats$chain.lengths)    # 5,988 chains
summary(chain.stats$chain.lengths)

# The number of chains in which a node appears in that position in a chain
chain.stats$node.pos.counts

# Basal nodes only have counts in the first column.
chain.stats$node.pos.counts[BasalNodes(TL84),]

# Consumers only have counts in columns two and up.
chain.stats$node.pos.counts[c(IntermediateNodes(TL84),TopLevelNodes(TL84)),]

# All counts are zero for isolated nodes IsolatedNodes.
chain.stats$node.pos.counts[IsolatedNodes(TL84),]

Run the code above in your browser using DataLab