Skip to contents

This method returns a dataframe reporting the number of events fired up to each sampled simulation time.

Value

A dataframe reporting event, mutant, epistate, fired, and time for each event type, 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(name = "A",
               epigenetic_rates = c("+-" = 0.01, "-+" = 0.01),
               growth_rates = c("+" = 0.2, "-" = 0.08),
               death_rates = c("+" = 0.1, "-" = 0.01))
sim$place_cell("A+", 500, 500)
sim$history_delta <- 20
sim$run_up_to_time(70)
#> 
 [████████████----------------------------] 29% [00m:00s] Saving snapshot                                     

 [████████████----------------------------] 29% [00m:00s] Cells: 0                                            

 [████████████----------------------------] 29% [00m:00s] Cells: 0                                            

 [████████████----------------------------] 29% [00m:00s] Cells: 0                                            


# get the number of event fired per event and species
sim$get_firing_history()
#>     event mutant epistate fired     time
#> 1   death      A        -     0 20.00000
#> 2  growth      A        -     0 20.00000
#> 3  switch      A        -     0 20.00000
#> 4   death      A        +     2 20.00000
#> 5  growth      A        +     1 20.00000
#> 6  switch      A        +     0 20.00000
#> 7   death      A        -     0 20.91435
#> 8  growth      A        -     0 20.91435
#> 9  switch      A        -     0 20.91435
#> 10  death      A        +     2 20.91435
#> 11 growth      A        +     1 20.91435
#> 12 switch      A        +     0 20.91435