community_scenarios | R Documentation |
Generate scenarios for site by species matrices
community_random(rn, mc, prevalence = 0.25, allow_empty_sites = TRUE)
community_equilibrium(rn, mc)
rn |
A |
mc |
A |
prevalence |
A vector of length 1 or |
allow_empty_sites |
Logical, if FALSE then empty sites will be filled with a single species at random; this may result in slight departures from the desired prevalence. |
community_random will ensure that all sites have at least one species. If many species have low prevalence, it may be that the initial random draw produces many zero-richness sites, in which case one species will be selected at random for each of these sites. This can have the side effect that the prevalences in the end do not match the desired prevalence very closely.
community_equilibrium simply places species at all sites where they are expected to be present at equilibrium, in the absence of competition (i.e., the fundamental niche is positive).
A site by species matrix, with sites taken from rc
and species from mc
Q = rep(1, 4)
adj = matrix(0, nrow = 4, ncol = 4)
adj[1,2] = adj[2,3] = adj[4,3] = 1
rn = river_network(adj, Q)
st0=rep(0.4,nrow(adj))
state(rn, "resources") = st0
mc = metacommunity()
state(rn, "species") = community_random(rn, mc)
plot(rn, variable = "species")
state(rn, "species") = community_equilibrium(rn, mc)
plot(rn, variable = "species")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.