Getting the history of the number of cells per species
Source:R/RcppExports.R
SpatialSimulation-cash-get_count_history.Rd
This method returns a dataframe reporting the number of species cells in each sampled simulation time.
Value
A dataframe reporting mutant
, epistate
, counts
,
and time
for each species, and for each sampled time.
Examples
# set the seed of the random number generator
set.seed(0)
# create a simulation
sim <- SpatialSimulation()
sim$add_mutant("A", growth_rate = 0.2, death_rate = 0.1)
sim$add_mutant("B", growth_rate = 0.15, death_rate = 0.05)
sim$schedule_mutation(src = "A", dst = "B", time = 50)
sim$place_cell("A", 500, 500)
sim$history_delta <- 20
sim$run_up_to_time(70)
#>
[████████████████████████████████████████] 100% [00m:00s] Saving snapshot
# get the history of species counts
sim$get_count_history()
#> mutant epistate count time
#> 1 A 7 20.00000
#> 2 B 0 20.00000
#> 3 A 97 40.00000
#> 4 B 0 40.00000
#> 5 A 287 60.00000
#> 6 B 2 60.00000
#> 7 A 513 70.00668
#> 8 B 3 70.00668