Learn R Programming

amt (version 0.0.7)

track: Create a track_*

Description

Constructor to crate a track, the basic building block of the amt package. A track is usually created from a set of x and y coordinates, possibly time stamps, and any number of optional columns, such as id, sex, age, etc.

Usage

mk_track(tbl, .x, .y, .t, ..., crs = NULL, order_by_ts = TRUE,
  check_duplicates = FALSE)

make_track(tbl, .x, .y, .t, ..., crs = NULL, order_by_ts = TRUE, check_duplicates = FALSE)

track(x, y, t, ..., crs = NULL)

Arguments

tbl

data.frame The data.frame from which a track should be created.

.x, .y, .t

[expression(1)] Unquoted variable names of columns containing the x and y coordinates, and optionally a time stamp.

...

[expression] Additional columns from tbl to be used in a track. Columns should be provided in the form of key = val (e.g., for ids this may look like this id = c(1, 1, 1, 2, 2, 2 for three points for ids 1 and 2 each).

crs

[sp::CRS] An optional coordinate reference system of the points.

order_by_ts

[logical(1)] Should relocations be ordered by time stamp, default is TRUE.

check_duplicates

[logical(1)=FALSE] Should it be checked if there are duplicated time stamp, default is FALSE.

x, y

[numeric] The x and y coordinates.

t

[POSIXct] The time stamp.

Value

If t was provided an object of class track_xyt is returned otherwise a track_xy.