as.traj: Working with Trajects in 2D Space

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

The class traj is intended to explore trajects 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 trajects.
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
as.traj(id, xy, date, burst = id, ...)
## S3 method for class 'traj'
print(x, ...)
## S3 method for class 'traj'
summary(object, id = levels(object$id), date = NULL, ...)
## S3 method for class 'traj'
plot(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 or a character vector 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 with 2 columns containing the x and y 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 or a character vector 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, trajects 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)

Clement Calenge clement.calenge@oncfs.gouv.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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
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)

ClementCalenge/adehabitat documentation built on May 6, 2019, 12:02 p.m.