TrajFromTrjPoints {trajr}R Documentation

Create a trajectory from a subset of another

Description

Creates a trajectory from a subset of the points in another trajectory, preserving metadata and all columns in the original trajectory.

Usage

TrajFromTrjPoints(trj, idx)

Arguments

trj

Trajectory to extract points and metadata from.

idx

Indices of the points in trj to retain in the new trajectory.

Details

Note that removing points from a trajectory that does not contain a time column will change the timing of the points, and hence change velocity etc.

Value

A new trajectory which is the same as trj except with a subset of points.

Examples

## Not run: 
# Create a trajectory (trj2) by removing all zero-length
# segments from another trajectory (trj). Keep all points
# that are different from their preceding point, and also
# keep the start point
trj2 <- TrajFromTrjPoints(trj, c(1, which(Mod(trj$displacement) != 0)))

## End(Not run)


[Package trajr version 1.5.1 Index]