Given a set of coordinates representing an object's trajectory, this function builds a trajectory table that can then be used to work with the functions provided by the swaRm package.

track(id = NULL, x, y, z = NULL, t, t0 = NULL, units = "secs",
  geo = FALSE, tz = NULL)



A unique identifier for the trajectory. It can be a number or a character string. If not set, it defaults to 0. Multiple track identifiers can be passed to the function, in which case id should be a vector of the same length as x.

x, y, z

Vectors of coordinates. Note that z is not required. If geo=TRUE, then x will correspond to longitudes, y to latitudes and z to altitudes.


A numeric vector of the time elapsed since the beginning of the tracking. The time units are specified in units.


The time at which tracking began. It can be any object that can be converted to a date-time by as_datetime. If not specified, it defaults to the date-time returned by now.


A character string indicating the units in which t as been recorded (default: "secs"). See units for more details.


A logical value indicating whether the locations are defined by geographic coordinates (default: FALSE).


An optional time zone specification for t0. If not specified, it defaults to the system's time zone. See timezone for more \ details.


A trajectory table.

See also