| RemoveNodes | R Documentation |
Remove one or more nodes.
RemoveNodes(community, remove, title,
method=c('direct','secondary','cascade'))
community |
an object of class |
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. |
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.
A new object of class Community.
Lawrence Hudson
Community, BasalNodes,
IsolatedNodes, NumberOfNodes
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.