Learn R Programming

metaRange (version 1.1.4)

metaRangeSpecies: metaRangeSpecies object

Description

Creates an species object in form of an R6 class that stores and handles all the individual parts that define a species.

Arguments

Value

A <metaRangeSpecies> object.

Public fields

name

<string> name or ID of the species.

processes

<list> of <metaRangeProcesses>. The processes that describe how the species interacts with the environment, itself and other species.

traits

<environment> holds the traits of the species.

sim

<metaRangeSimulation> A reference to the metaRangeSimulation simulation object that the species is part of. Useful to access environmental data or data of other species.

Methods


Method new()

Creates a new metaRangeSpecies object

Usage

metaRangeSpecies$new(name, sim)

Arguments

name

<string> name or ID of the species.

sim

<metaRangeSimulation> A reference to the metaRangeSimulation simulation object that the species is part of. Useful to access environmental data or data of other species.

Returns

A <metaRangeSpecies> object.

Examples

# The following is bad practice, since species should be added to a simulation
# via the add_species method of the simulation object. But for illustration
# purposes:
sim_env <- terra::sds(terra::rast(vals = 1, nrow = 2, ncol = 2))
test_sim <- metaRangeSimulation$new(source_environment = sim_env)
sp <- metaRangeSpecies$new(name = "species_01", sim = test_sim)
sp


Method print()

Prints information about the species to the console

Usage

metaRangeSpecies$print()

Returns

<invisible self>

Examples

Run this code

## ------------------------------------------------
## Method `metaRangeSpecies$new`
## ------------------------------------------------

# The following is bad practice, since species should be added to a simulation
# via the add_species method of the simulation object. But for illustration
# purposes:
sim_env <- terra::sds(terra::rast(vals = 1, nrow = 2, ncol = 2))
test_sim <- metaRangeSimulation$new(source_environment = sim_env)
sp <- metaRangeSpecies$new(name = "species_01", sim = test_sim)
sp

Run the code above in your browser using DataLab