Description Usage Arguments Details Value Author(s) See Also Examples
Community factory.
1 2 3 4 |
S |
number of nodes in the generated communities. |
nodes |
either a vector of node names or a |
generator |
function used to generate sets of trophic links. |
n |
number of communities to generate. |
accept |
either |
energetically.feasible |
if |
trace.progress |
if |
validate |
if 'TRUE', created communities are validated using the checks
provided by Cheddar's |
properties |
either |
... |
. |
Either ‘S’ or ‘nodes’ should be provided - no need to provide both.
A list
of ‘n’ Community
objects.
Lawrence Hudson
Community
, PreyAveragedTrophicLevel
IsIsolatedNode
, IsolatedNodes
IsBasalNode
, BasalNodes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | # Example 1
# Use the niche model to create 12 communities containing 25 species with a
# directed connectance close to 0.15.
communities <- CommunityFactory(S=25, n=12, generator=NicheModelLinks, C=0.15)
# Communities are named 'Artificial community 1'..'Artificial community n'
names(communities)
# Each has 25 nodes
sapply(communities, NumberOfNodes)
# Each has a C close to 0.15
sapply(communities, DirectedConnectance)
hist(sapply(communities, DirectedConnectance))
# Plot nodes stacked vertically by trophic level
plot(communities, ncol=4)
# At least one community will have a non-zero number of isolated nodes
sapply(communities, function(c) return(length(IsolatedNodes(c))))
# Example 2
# Use the accept argument to ensure that the communities have no isolated
# nodes, using Cheddar' IsIsolatedNode function
communities <- CommunityFactory(S=25,
n=12,
generator=NicheModelLinks,
C=0.15,
accept=function(c) 0==sum(IsIsolatedNode(c)))
# All zero
sapply(communities, function(c) return(length(IsolatedNodes(c))))
# Example 3
# Guarantee that communities have no isolated nodes and exactly 5 basal nodes -
# use Cheddar's IsBasalNode function for this; also get CommunityFactory to
# trace its progress.
communities <- CommunityFactory(S=25,
n=12,
generator=NicheModelLinks,
C=0.15,
accept=function(c) 0==sum(IsIsolatedNode(c)) &&
5==sum(IsBasalNode(c)),
trace.progress=TRUE)
# No community has isolated nodes
all(0==sapply(communities, function(c) return(length(IsolatedNodes(c)))))
# All communities have five basal nodes
all(5==sapply(communities, function(c) return(length(BasalNodes(c)))))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.