This is used in conjunction with which will make the code valid in R. Note that the R function is a stub, it does not do anything in R (except bring up this documentation). It will only do anything useful when used inside a \code\linkslim_block function further nested in a \code\linkslim_script function call, where it will be translated into valid SLiM code as part of a full SLiM script.

lhs %?% rhs

Arguments

lhs

A condition

rhs

A SLiM expression to be executed if the condition is TRUE

Author

Benjamin C Haller (\emailbhaller@benhaller.com) and Philipp W Messer (\emailmesser@cornell.edu)

Examples

slim_script(slim_block_init_minimal(),
            slim_block(cat(fixed %?% "FIXED\\n" %else% "LOST\\n"))) |>
  as_slim_text() |>
  cat()
#> initialize() {
#>     initializeMutationRate(1e-07);
#>     initializeMutationType("m1", 0.5, "f", 0);
#>     initializeGenomicElementType("g1", m1, 1);
#>     initializeGenomicElement(g1, 0, 1e+05 - 1);
#>     initializeRecombinationRate(1e-08);
#> }
#> 
#> 1:1 early() {
#>     cat(fixed ? "FIXED\\n" else "LOST\\n");
#> }