Skip to contents

The objects of this class represent one among the following quantities:

  • the cardinality of a species;

  • the number fired event among deaths, duplications and switches in a species;

  • the elapse simulation time.

See also

Simulation$var() to build a variable

Examples

# build a simulation and add two species to it
# set the seed of the random number generator
set.seed(0)

# create a simulation
sim <- SpatialSimulation()
sim$add_mutant(name = "A",
               epigenetic_rates = c("+-" = 0.01, "-+" = 0.01),
               growth_rates = c("+" = 0.2, "-" = 0.08),
               death_rates = c("+" = 0.1, "-" = 0.01))

# get the variable representing the cardinality of A+ in sim
sim$var("A+")
#> |A+|

# get the variable representing the number of duplications in A+
sim$var("A+.duplications")
#> |A+.duplications|

# get the variable representing the simulation time
sim$var("Time")
#> Time

# the logic variables can be stored in an R variable
va_p <- sim$var("A+")
va_p
#> |A+|