randomE | R Documentation |
Generate random efficiency matrix for consumer resource model from Dirichlet distribution, where positive efficiencies indicate the consumption of resources, whilst negatives indicate that the species would produce the resource.
randomE(
n_species,
n_resources,
names_species = NULL,
names_resources = NULL,
mean_consumption = n_resources/4,
mean_production = n_resources/6,
maintenance = 0.5,
trophic_levels = NULL,
trophic_preferences = NULL,
exact = FALSE
)
n_species |
Integer: number of species |
n_resources |
Integer: number of resources |
names_species |
Character: names of species. If NULL,
|
names_resources |
Character: names of resources. If NULL,
|
mean_consumption |
|
mean_production |
|
maintenance |
|
trophic_levels |
|
trophic_preferences |
|
exact |
|
randomE
returns a matrix E with dimensions (n_species x n_resources),
and each row represents a species.
# example with minimum parameters
ExampleEfficiencyMatrix <- randomE(n_species = 5, n_resources = 12)
# examples with specific parameters
ExampleEfficiencyMatrix <- randomE(
n_species = 3, n_resources = 6,
names_species = letters[1:3],
names_resources = paste0("res", LETTERS[1:6]),
mean_consumption = 3, mean_production = 1
)
ExampleEfficiencyMatrix <- randomE(
n_species = 3, n_resources = 6,
maintenance = 0.4
)
ExampleEfficiencyMatrix <- randomE(
n_species = 3, n_resources = 6,
mean_consumption = 3, mean_production = 1, maintenance = 0.4
)
# examples with microbial trophic levels
ExampleEfficiencyMatrix <- randomE(
n_species = 10, n_resources = 15,
trophic_levels = c(6, 3, 1),
trophic_preferences = list(
c(rep(1, 5), rep(-1, 5), rep(0, 5)),
c(rep(0, 5), rep(1, 5), rep(-1, 5)),
c(rep(0, 10), rep(1, 5))
)
)
ExampleEfficiencyMatrix <- randomE(
n_species = 10, n_resources = 15,
trophic_levels = c(6, 3, 1),
trophic_preferences = list(c(rep(1, 5), rep(-1, 5), rep(0, 5)), NULL, NULL)
)
ExampleEfficiencyMatrix <- randomE(
n_species = 10, n_resources = 15,
trophic_levels = c(6, 3, 1)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.