Skip to contents

This method initialises a trajectory object, which comprises a chain of activities that can be attached to a generator. See below for a complete list of available activities by category.

Usage

trajectory(name = "anonymous", verbose = FALSE)

Arguments

name

the name of the trajectory.

verbose

enable showing additional information.

Value

Returns an environment that represents the trajectory.

See also

Available activities by category:

Manage trajectories:

Examples

## create an empty trajectory
x <- trajectory("my trajectory")
x
#> trajectory: my trajectory, 0 activities

## add some activities by chaining them
x <- x %>%
  log_("here I am!") %>%
  timeout(5) %>%
  log_("leaving!")
x
#> trajectory: my trajectory, 3 activities
#> { Activity: Log          | message: here I am!, level: 0 }
#> { Activity: Timeout      | delay: 5 }
#> { Activity: Log          | message: leaving!, level: 0 }

## join trajectories
x <- join(x, x)

## extract and replace
x[c(3, 4)] <- x[2]
x
#> trajectory: my trajectory, 6 activities
#> { Activity: Log          | message: here I am!, level: 0 }
#> { Activity: Timeout      | delay: 5 }
#> { Activity: Timeout      | delay: 5 }
#> { Activity: Timeout      | delay: 5 }
#> { Activity: Timeout      | delay: 5 }
#> { Activity: Log          | message: leaving!, level: 0 }