This function takes output produced from a slimr_script which uses r_output, and converts it into a tibble

slim_extract_output_data(output)

Arguments

output

Character vector produced from SLiM run.

Value

A tibble with four columns:

generation

A vector of generations where output was produced.

name

Names of the output data.

expression

The SLiM expression used to generate the output.

data

The raw data output from SLiM as a character vector.

Examples

if(slim_is_avail()) {
  test_sim <- slim_script(
    slim_block_init_minimal(),
    slim_block_add_subpops(1, 100),
    slim_block(1, 20, late(), {
      r_output(p1$size(), "MS", do_every = 10)
    })
  ) %>%
    slim_run(simple = TRUE)
  slim_extract_output_data(test_sim$output)
}
#> 
#> 
#> Simulation finished with exit status: 0
#> 
#> Success!
#> $data
#> # A tibble: 2 × 5
#>   generation name  expression type                data 
#>        <int> <chr> <chr>      <chr>               <chr>
#> 1         10 MS    p1.size()  "integer [0:0] 1\n" 1    
#> 2         20 MS    p1.size()  "integer [0:0] 1\n" 1    
#> 
#> $extra_out
#> character(0)
#> 
#> $leftovers
#> character(0)
#> 
#> $last_line
#> [1] 23
#>