add_stage: Add one or more stages to an experiment

Description Usage Arguments Details Examples

Description

Add one or more stages to an experiment

Usage

1
add_stage(experiment, ..., times, each, after)

Arguments

experiment

an Experiment object

...

one or more Stage objects, or functions

times

how many times to repeat the sequence of stages in .... All stages are repeated if this is a single number; if it is a vector it gives how many times to repeat each stage.

each

how many times to repeat each individual stage

after

Add stages after how many stages (default: at the end)

Details

If functions are passed in to add_stage, Stage objects will automatically be created from them. Stage objects are reference classes. However, when added to the experiment, they are copied. So, changing the Stage after adding it to the experiment will not work.

Examples

1
2
3
4
5
6
7
8
expt <- experiment(N=1, autostart=TRUE)
s1 <- stage(function(id, period, params) return("Got to s1!"))
# Or just define the function directly:
s2 <- function(id, period, params) return("Got to s2!")
add_stage(expt, s1, s2, times=2) # s1 s2 s1 s2
add_stage(expt, s1, s2, times=1:2) # s1 s2 s2
add_stage(expt, s1, s2, each=2) # s1 s1 s2 s2
info(expt)

hughjonesd/betr documentation built on May 17, 2019, 9:11 p.m.