Get the number of activities in a trajectory. length returns the number of first-level activities (sub-trajectories not included). get_n_activities returns the total number of activities (sub-trajectories included).

# S3 method for trajectory
length(x)

get_n_activities(x)

Arguments

x

the trajectory object.

Value

Returns a non-negative integer of length 1.

See also

Examples

x <- trajectory() %>% timeout(1) x <- x %>% clone(2, x, x) x
#> trajectory: anonymous, 4 activities #> { Activity: Timeout | delay: 1 } #> { Activity: Clone | n: 2 } #> Fork 1, continue, trajectory: anonymous, 1 activities #> { Activity: Timeout | delay: 1 } #> Fork 2, continue, trajectory: anonymous, 1 activities #> { Activity: Timeout | delay: 1 }
## length does not account for subtrajectories length(x)
#> [1] 2
get_n_activities(x)
#> [1] 4