Operators acting on trajectories to extract or replace parts.

# S3 method for trajectory
[(x, i)

# S3 method for trajectory
[[(x, i)

# S3 method for trajectory
[(x, i) <- value

# S3 method for trajectory
[[(x, i) <- value



the trajectory object.


indices specifying elements to extract. Indices are numeric or character or logical vectors or empty (missing) or NULL.

Numeric values are coerced to integer as by as.integer (and hence truncated towards zero). Negative integers indicate elements/slices to leave out the selection.

Character vectors will be matched to the names of the activities in the trajectory as by %in%.

Logical vectors indicate elements/slices to select. Such vectors are recycled if necessary to match the corresponding extent.

An empty index will return the whole trajectory.

An index value of NULL is treated as if it were integer(0).


another trajectory object.


Returns a new trajectory object.

See also

length.trajectory, get_n_activities, join.