RemoveNodes {cheddar} | R Documentation

## Remove nodes

### Description

Remove one or more nodes.

### Usage

    RemoveNodes(community, remove, title,
                       method=c('direct','secondary','cascade'))

### Arguments

`community` | an object of class `Community`.
`remove` | a vector of either names, integer indices or logicals indicating nodes to be removed.
`title` | a title for the new community.
`method` | how species removals are propogated through the food web.

### Details

Returns a new `Community` with nodes in `remove` removed. An error is raised if `remove` refers to nodes not in the `community` of if `remove` refers to all nodes in the `community`.

If `method` is ‘direct’, only the nodes in `remove` are removed. If `method` is ‘secondary’, secondarily extinct nodes - those that directly consume one or more nodes in ‘remove’ and that no longer have any resources (except themselves) after the removal - are also removed. If `method` is ‘cascade’, a multistep version of ‘secondary’ is applied. This has the effect of propogating extinctions though the community - all consumers that are ultimately dependent upon all species in ‘remove’, and upon no other nodes (except themselves), will be removed.

### Value

A new object of class `Community`.

### Author(s)

Lawrence Hudson

### See Also

`Community`, `BasalNodes`, `IsolatedNodes`, `NumberOfNodes`

### Examples

    data(TL84)

    # Three different ways of removing node 56 (Umbra limi)
    a <- RemoveNodes(TL84, 56)
    b <- RemoveNodes(TL84, 'Umbra limi')
    c <- RemoveNodes(TL84, c(rep(FALSE,55), TRUE))

    identical(a,b)  # TRUE
    identical(a,c)  # TRUE

    # The behaviours of the different methods
    NumberOfNodes(TL84)         # 56 nodes in total
    length(BasalNodes(TL84))    # 25 basal nodes
    length(IsolatedNodes(TL84)) #  6 isolated nodes

    RemoveNodes(TL84, BasalNodes(TL84)) # 56 - 25 = 31 nodes remain
    RemoveNodes(TL84, BasalNodes(TL84), method='secondary') # 14 nodes remain
    RemoveNodes(TL84, BasalNodes(TL84), method='cascade')   # 6 isolated nodes remain

    # Results in an error
    ## Not run: RemoveNodes(TL84, 1:NumberOfNodes(TL84))

[Package cheddar version 0.1-633 Index]