Generate a code block that just adds subpopulations to a SLiM simulation

slim_block_add_subpops(
  n_pop = 1,
  sizes,
  generation = 1,
  when = c("early", "late")
)

Arguments

n_pop

Number of subpopulations to add

sizes

Population sizes of subpopulations. Should have a length equal to n_pop, or else a length of 1 (in which case it will be recycled to n_pop)

generation

The generation to add the subpopulations (default: 1)

when

When to add the subpopulations ("early" or "late"). Default: "early"

Value

A slimr_block object

Examples

slim_block_add_subpops(2, 100)
#> A slimr_block:
#> <slimr_script[1]>
#> block_1:1 early() {
#>     {
#>         sim.addSubpop(p1, 100);
#>         sim.addSubpop(p2, 100);
#>     }
#> }