Description Usage Arguments Details Value Examples
View source: R/gen3sis_species.R
Creates a new species
1 | create_species(initial_cells, config)
|
initial_cells |
a list of initial sites (strings) to occupy |
config |
the configuration information |
This function is to be used in the create_ancestor_species function at the configuration of a simulation. It will create a species object representing one species in the simulation occupying the given list of initial sites
returns a newly created species occupying the provided initial cells
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 | ## Not run:
# inside a create_ancestor_species function of a config taking a landscape and a config
# create_species creates a new species
# define range of species for the entire world in this case lat long system
range <- c(-180, 180, -90, 90)
## select coordinates within the range stipulated above
# takes landscape coordinates
co <- landscape$coordinates
# select coordinates within the range
selection <- co[, "x"] >= range[1] &
co[, "x"] <= range[2] &
co[, "y"] >= range[3] &
co[, "y"] <= range[4]
# get the initial cells
initial_cells <- rownames(co)[selection]
# call create_species
new_species <- create_species(initial_cells, config)
# extra: set local adaptation to max optimal temp equals local temp
new_species$traits[ , "temp"] <- landscape$environment[,"temp"]
# extra: set a certaintrait (e.g. traitX) to one on all populations of this species
new_species$traits[ , "tratiX"] <- 1
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.