Use slim_results_to_data
on the slim_run
results to get this in a nice SNP matrix form.
r_output_snp(name = "snp", subpops = FALSE, ...)
slimr_output_snp(name = "snp", subpops = FALSE, ...)
Name of output to use to label it in slimr_results object
. Default is "snp"
.
Should the subpopulation of each sequence be outputted as well?
Other arguments to be passed to r_output
None
if(slim_is_avail()) {
test_sim <- slim_script(
slim_block_init_minimal(mutation_rate = 1e-6),
slim_block_add_subpops(1, 100),
slim_block(1, 20, late(), {
r_output_snp("snp", do_every = 10)
})
) %>%
slim_run()
slim_results_to_data(test_sim)
}
#>
#>
#> Simulation finished with exit status: 0
#>
#> Success!
#> # A tibble: 2 × 6
#> type expression generation name data pos
#> <chr> <chr> <int> <chr> <list> <list>
#> 1 slim_snp slimr_output_snp() 10 snp <dbl [100 × 93]> <chr [93]>
#> 2 slim_snp slimr_output_snp() 20 snp <dbl [100 × 98]> <chr [98]>