TrophicChains {cheddar} | R Documentation

## Trophic chains

### Description

Enumerates every trophic chain in a food web.

### Usage

    TrophicChains(community, node.properties = NULL, chain.properties = NULL)

### Arguments

`community` | an object of class `Community`.
`node.properties` | the names of the node properties to return. Should meet the criteria of the `properties` parameter of `NPS`.
`chain.properties` | the names of chain properties to return.

### Details

Enumerates every trophic chain in the food-web and returns a `data.frame` containing any requested node and trophic-link columns.

Some network properties and analyses require knowledge of every unique path - ‘trophic chain’ - through the food-web. A trophic chain starts at a basal node (`BasalNodes`) and ends when it is not possible to add nodes that are not already in the chain, so loops and cannibalism are ignored. For communities that have one or more top-level nodes (`TopLevelNodes`) each trophic chain will end with a top-level node.

If your analysis requires only simple statistics about trophic chains, the `TrophicChainsStats` function is more suitable as it is much faster and requires less memory than `TrophicChains`. This is particularly true for communities that contain a large number of trophic chains, such as the `SkipwithPond` dataset, which has more than $10^5$ unique chains.

It will not be possible to compute, within reasonable time and available system memory, trophic chains for food webs with a large number of nodes and/or trophic links. `TrophicChains` will raises an error 'Unable to compute paths' for these food webs. The ‘Large numbers of trophic chains’ section of the ‘Community’ vignette explains this in more detail.

### Value

A `data.frame`.

### Author(s)

Lawrence Hudson

### See Also

`BasalNodes`, `TopLevelNodes`, `TLPS`, `ThreeNodeChains`, `TrophicChainsStats`, `SkipwithPond`

### Examples

    data(TL84)

    tc <- TrophicChains(TL84)

    # Every chain starts with a basal node
    BasalNodes(TL84)
    first <- tc[,1]
    all(IsBasalNode(TL84)[unique(first)])

    # TL84 has a single top-level consumer - every trophic chain ends with this
    # consumer
    TopLevelNodes(TL84)
    # Get the last node in each chain
    last <- apply(tc, 1, function(row) row[max(which(""!=row))])
    unique(last)

    # M of nodes
    head(TrophicChains(TL84, node.properties='M'))

    # M and N of nodes
    head(TrophicChains(TL84, node.properties=c('M','N')))

    # Skipwith Pond has more than 10e5 unique chains
    data(SkipwithPond)
    # Not all systems will be able to allocate the memory required to hold the
    # chains
    ## Not run: dim(TrophicChains(SkipwithPond))

[Package cheddar version 0.1-633 Index]