as.traj {adehabitat} | R Documentation

## Working with Trajectories in 2D Space

### Description

The class `traj` is intended to explore trajectories of animals monitored using radio-tracking.
`as.traj` creates an object of this class.
`summary.traj` returns the number of relocations for each "burst" of relocations and each animal.
`plot.traj` allows various graphical displays of the trajectories.
`getburst` returns an object of class `traj` satisfying the specified criteria (selection of one focus animal, of a period of interest, of special "bursts" (see details)).
`traj2df`, and the reciprocal function `df2traj` respectively converts an object of class `traj` to an object of class `data.frame`, and conversely.

### Usage

    as.traj(id, xy, date, burst = id, ...)
    print.traj(x, ...)
    summary.traj(object, id = levels(object$id), date = NULL, ...)
    plot.traj(x, id = levels(x$id), burst = levels(x$burst), date = NULL,
              asc = NULL, area = NULL,
              xlim = range(x$x), ylim = range(x$y),
              colasc = gray((256:1)/256), colpol = "green",
              addpoints = TRUE, addlines = TRUE,
              perani = TRUE, final = TRUE, ...)
    getburst(x, burst = levels(x$burst),
             id = levels(x$id), date = NULL)
    traj2df(x)
    df2traj(df)

### Arguments

`id` | a factor giving for each relocation the identity of the individual monitored in `as.traj`. a character vector containing the identity of the individuals of interest in other functions
`xy` | a data frame containing the coordinates of the relocations
`date` | a vector of class `POSIXct` giving the date for each relocation in `as.traj`. a vector of class `POSIXct` with length 2, indicating the beginning and the end of the period of interest in other functions
`burst` | a factor giving the identity of each "burst" of relocations in `as.traj` (e.g. the circuit id, see details). The burst level needs to be unique (two animals cannot have the same burst levels). a character vector containing the burst levels of interest in `plot.traj` and `getburst`
`x` | an object of class `traj`
`object` | an object of class `traj`
`asc` | an object of class `asc`
`area` | an object of class `area` (see `help(area)`)
`xlim` | the ranges to be encompassed by the x axis
`ylim` | the ranges to be encompassed by the y axis
`colasc` | a character vector giving the colors of the map of class `asc`
`colpol` | a character vector giving the colors of the polygon contour map, when `area` is not `NULL`
`addlines` | logical. If `TRUE`, lines joining consecutive relocations are drawn
`addpoints` | logical. If `TRUE`, points corresponding to each relocation are drawn
`perani` | logical. If `TRUE`, one plot is drawn for each level of the factor `id`, and for a given animal, the several bursts are superposed on the same plot. If `FALSE`, one plot is drawn for each level of the factor `burst`
`final` | logical. If `TRUE`, the initial and final relocations of each burst are indicated in blue and red, respectively
`df` | a data frame to be converted to the class `traj`
`...` | other optional vectors containing some variables measured at each relocation (e.g. temperature, wind, elevation, etc.) in `as.traj`. For other functions, arguments to be passed to the generic functions `plot`, `summary` and `print`

### Details

For a given individual, trajectories are often sampled as "bursts" of relocations (Dunn and Gipson, 1977). For example, when an animal is monitored using radio-tracking, the data may consist of several circuits of activity (two successive relocations on one circuit are often highly autocorrelated, but the data from two circuits may be sampled at long intervals in time). These bursts are indicated by the factor `burst`.

### Value

An object of class `traj` is a data frame with one column named `id`, one column named `x`, one column named `y`, one column named `date` and one column named `burst`. This class therefore inherits from the class `data.frame`.

### Author(s)

Clément Calenge calenge@biomserv.univ-lyon1.fr

### References

Dunn, J.E. and Gipson, P.S. (1977) Analysis of radio telemetry data in studies of home range. Biometrics. 59, 794–800.

### See Also

`as.POSIXct` and `strptime` for additional information of the class `POSIX`.

### Examples

    data(puechabon)
    locs <- puechabon$locs
    locs[1:4,]

    ### Conversion of the date to the format POSIX
    da <- as.character(locs$Date)
    da <- as.POSIXct(strptime(as.character(locs$Date),
                   "%y%m%d"))

    ### Creation of the object of class "traj"
    (tr <- as.traj(id = locs$Name, xy = locs[,c("X", "Y")],
                   date = da))
    summary(tr)
    plot(tr)

    ### Displays on maps of the study area
    k <- puechabon$kasc
    ele <- getkasc(k, "Elevation")
    plot(tr, asc = ele)

    ### Case with several burst per animal
    data(puechcirc)
    plot(puechcirc, asc = ele)
    plot(puechcirc, asc = ele, perani = FALSE)

[Package adehabitat version 1.3 Index]