CollectionApply {cheddar} | R Documentation |
Collection apply
Description
Apply a function to every Community
in a
CommunityCollection
. Works the same as lapply
but returns a
CommunityCollection
rather than a list
.
Usage
CollectionApply(collection, f, ...)
Arguments
collection |
an object of class |
f |
a function to be applied to each |
... |
optional arguments passed to |
Value
A new object of class CommunityCollection
.
Author(s)
Lawrence Hudson
See Also
Examples
data(pHWebs)
# Remove isolated nodes from each community
CollectionCPS(pHWebs, 'FractionIsolatedNodes')
pHWebs.no.iso <- CollectionApply(pHWebs, RemoveIsolatedNodes)
CollectionCPS(pHWebs.no.iso, 'FractionIsolatedNodes')
# Remove cannibalistic links from each community
sapply(pHWebs, function(community) length(Cannibals(community)))
pHWebs.no.can <- CollectionApply(pHWebs, RemoveCannibalisticLinks)
sapply(pHWebs.no.can, function(community) length(Cannibals(community)))
# Order the nodes each community by body mass
head(CollectionNPS(pHWebs))
pHWebs.by.M <- CollectionApply(pHWebs, OrderCommunity, 'M')
head(CollectionNPS(pHWebs.by.M))
[Package cheddar version 0.1-639 Index]