View source: R/data-structures.R
tracks | R Documentation |
The function tracks
is used to create tracks objects. as.tracks
coerces
its argument to a tracks object, and is.tracks
tests for tracks objects.
c
can be used to combine (concatenate) tracks objects.
as.tracks(x, ...) ## S3 method for class 'list' as.tracks(x, ...) is.tracks(x) ## S3 method for class 'tracks' c(...) tracks(...)
x |
an object to be coerced or tested. |
... |
for For For |
Tracks objects are lists of matrices. Each matrix contains at least two
columns; the first column is time, and the remaining columns are a spatial coordinate.
The following naming conventions are used (and enforced by tracks
): The time
column has the name 't', and spatial coordinate columns have names 'x','y','z' if there
are three or less coordinates, and 'x1',...,'xk' if there are k ≥ 4
coordinates. All tracks in an object must have the same number of dimensions. The
positions in a track are expected to be sorted by time (and the constructor
tracks
enforces this).
A tracks
object.
## A single 1D track x <- tracks( matrix(c(0, 8, 10, 9, 20, 7, 30, 7, 40, 6, 50, 5), ncol=2, byrow=TRUE ) ) ## Three 3D tracks x2 <- tracks( rbind( c(0,5,0), c(1,5,3), c(2,1,3), c(3,5,6) ), rbind( c(0,1,1),c(1,1,4),c(2,5,4),c(3,5,1),c(4,-3,1) ), rbind( c(0,7,0),c(1,7,2),c(2,7,4),c(3,7,7) ) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.