slimr_write: Write a slimr_script object to a text file

Description Usage Arguments Value Examples

View source: R/slimr_script.R

Description

Write a slimr_script object to a text file, which can be run in SLiM as a SLiM script

Usage

1

Arguments

x

slimr_script object to write to file

file

File path to write to

...

Further arguments to be passed to or from other objects

Value

Returns x, invisibly

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
slim_script(
   slim_block(initialize(),
          {
            initializeMutationRate(1e-7);
            initializeMutationType("m1", 0.5, "f", 0.0);
            initializeGenomicElementType("g1", m1, 1.0);
            initializeGenomicElement(g1, 0, 99999);
            initializeRecombinationRate(1e-8);
          }),
   slim_block(1,
          {
            sim.addSubpop("p1", 500);
          }),
   slim_block(10000,
          {
            sim.simulationFinished();
          })
) -> script
temp_file <- tempfile(fileext = ".txt")
slimr_write(script, temp_file)
readLines(temp_file)

rdinnager/slimrlang documentation built on June 20, 2020, 8:17 p.m.