Description Usage Arguments Details Value Note Author(s) References See Also Examples
The class ltraj
is intended to store trajectories of
animals. Trajectories of type II correspond to trajectories for which the
time is available for each relocation (mainly GPS and
radio-tracking). Trajectories of type I correspond to trajectories for which
the time has not been recorded (e.g. sampling of tracks in the snow).
as.ltraj
creates an object of this class.
summary.ltraj
returns the number of relocations (and missing
values) for each "burst" of relocations and each animal.
traj2ltraj
, and the reciprocal function ltraj2traj
respectively converts an object of class ltraj
to an object of
class traj
, and conversely.
rec
recalculates the descriptive parameters of an object of
class ltraj (e.g. after a modification of the contents of this object,
see examples)
1 2 3 4 5 6 7 8 9 |
x, object |
an object of class |
xy |
a data.frame containing the x and y coordinates of the relocations |
date |
for trajectories of type II, a vector of class |
id |
either a character string indicating the identity of the
animal or a factor with length equal to |
burst |
either a character string indicating the identity of the
burst of relocations or a factor with length equal to
|
typeII |
logical. |
slsp |
a character string used for the computation of the turning angles (see details) |
traj |
an object of class |
... |
For other functions, arguments to be passed to the generic
functions |
Objects of class ltraj
allow the analysis of animal
movements. They contain the descriptive parameters of the moves
generally used in such studies (coordinates of the relocations, date,
time lag, relative and absolute angles, length of moves, increases
in the x and y direction, and dispersion R2n, see below).
The computation of turning angles may be problematic when successive
relocations are located at the same place. In such cases, at least
one missing value is returned. For example, let r1, r2, r3 and r4 be
4 successive relocations of a given animal (with coordinates (x1,y1),
(x2,y2), etc.). The turning angle in r2 is computed between the moves
r1-r2 and r2-r3. If r2 = r3, then a missing value is returned for the
turning angle at relocation r2. The argument slsp
controls the
value returned for relocation r3 in such cases. If slsp ==
"missing"
, a missing value is returned also for the relocation r3.
If slsp == "remove"
, the turning angle computed in r3 is the
angle between the moves r1-r2 and r3-r4.
For a given individual, trajectories are often sampled as "bursts"
of relocations. 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 attribute
burst
. Note that the bursts should be unique: do not use the
same burst id for bursts collected on different animals.
Two types of trajectories can be stored in objects of class ltraj
:
trajectories of type I correspond to trajectories where the time of
relocations is not recorded. It may be because it could not be noted
at the time of sampling (e.g. sampling of animals' tracks in the snow)
or because the analyst decided that he did not want to take it into
account, i.e. to study only its geometrical properties. In this case,
the variable date
in each burst of the object contains a vector
of integer giving the order of the relocations in the trajectory (i.e. 1,
2, 3, ...). Trajectories of type II correspond to trajectories for which the
time is available for each relocation. It is stored as a vector of
class POSIXct
in the column date
of each burst of
relocations. The type of trajectory should be defined when the object of
class ltraj
is defined, with the argument typeII
.
Concerning trajectories of type II, in theory, it is expected that the
time lag between two relocations is constant in all the bursts and all
the ids of one object of class
ltraj
(don't mix animals located every 10 minutes and animals
located every day in the same object). Indeed, some of the
descriptive parameters of the trajectory do not have any sense when
the time lag varies. For example, the distribution of relative
angles (angles between successive moves) depends on a given time
scale; the angle between two during 10-min moves of a whitestork
does not have the same biological meaning as the angle between two
1-day move. If the time lag varies, the underlying process varies
too. For this reason, most functions of adehabitat have been
developed for "regular" trajectories, i.e. trajectories with a
constant time lag (see help(sett0)
). Furthermore, several
functions are intended to help the user to transform an object of
class ltraj
into a regular object (see for example
help(sett0)
, and particularly the examples to see how regular
trajectories can be obtained from GPS data).
Nevertheless, the class ltraj
allows for variable time lag,
which often occur with some modes of data collection (e.g. with Argos
collars). But *we stress that their analysis is still an open
question!!*
Finally, the class ltraj
deals with missing values in the
trajectories. Missing values are frequent in the trajectories of
animals collected using telemetry: for example, GPS collar may not
receive the signal of the satellite at the time of relocation. Most
functions dealing with the class ltraj
have a specified
behavior in case of missing values.
It is recommended to store the missing values in the data *before*
the creation of the object of class ltraj
. For example, the
GPS data imported within R contain missing values. It is recommended
to *not remove* these missing values before the creation of the
object!!! These missing values may present patterns (e.g. failure to
locate the animal at certain time of the day or in certain habitat
types), and *the analysis of these missing values should be part of the
analysis of the trajectory* (e.g. see help(runsNAltraj)
and
help(plotNAltraj)
.
However, sometimes, the data come without any information concerning
the location of these missing values. If the trajectory is
approximately regular (i.e. approximately constant time lag), it is
possible to determine where these missing values should occur in the
object of class ltraj
. This is the role of the function
setNA
. For example of use of this class, type
demo(ltraj)
.
summary.ltraj
returns a data frame.
ltraj2traj
returns an object of class traj
.
All other functions return objects of class ltraj
. An object
of class ltraj
is a list with one component per burst of
relocations. Each component is a data frame with two attributes:
the attribute "id"
indicates the identity of the animal, and
the attribute "burst"
indicates the identity of the
burst. Each data frame stores the following columns:
x |
the x coordinate for each relocation |
y |
the y coordinate for each relocation |
date |
the date for each relocation (type II) or a vector of integer giving the order of the relocations in the trajectory. |
dx |
the increase of the move in the x direction. At least two
successive relocations are needed to compute |
dy |
the increase of the move in the y direction. At least two
successive relocations are needed to compute |
dist |
the length of each move. At least two
successive relocations are needed to compute |
dt |
the time interval between successive relocations |
R2n |
the squared net displacement between the current relocation and the first relocation of the trajectory |
abs.angle |
the angle between each move and the x axis. At least two
successive relocations are needed to compute |
rel.angle |
the turning angles between successive moves. At least
three successive relocations are needed to compute |
The class ltraj
is a better alternative to the class
traj
. Indeed, the class ltraj
already contains the
basic information needed for the modelling of movement processes. Type
demo(managltraj)
for example of management of such objects, and
demo(analysisltraj)
for example of analysis.
Clement Calenge clement.calenge@oncfs.gouv.fr
Stephane Dray dray@biomserv.univ-lyon1.fr
Calenge, C., Dray, S. and Royer, M. (in prep.) Studying Animals movements with the R software: what is a trajectory?
is.regular
and sett0
for additional
information on "regular" trajectories. setNA
and
runsNAltraj
for additional information on missing values
in trajectories. c.ltraj
to combine several objects of
class ltraj
, Extract.ltraj
to extract or replace
bursts of relocations, plot.ltraj
and
trajdyn
for graphical displays, gdltraj
to
specify a time period. For further information on the class
traj
, see traj
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | data(puechabon)
locs <- puechabon$locs
locs[1:4,]
xy <- locs[,c("X","Y")]
######################################################
##
## Example of a trajectory of type I (time not recorded)
(litrI <- as.ltraj(xy, id = locs$Name, typeII=FALSE))
plot(litrI)
## The components of the object of class "ltraj"
head(litrI[[1]])
######################################################
##
## Example of a trajectory of type II (time recorded)
### 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 an object of class "ltraj", with for
### example the first animal
(tr1 <- as.ltraj(xy[locs$Name=="Brock",],
date = da[locs$Name=="Brock"],
id="Brock"))
## The components of the object of class "ltraj"
head(tr1[[1]])
## With all animals
(litr <- as.ltraj(xy, da, id = locs$Name))
## Change something manually in the first burst:
head(litr[[1]])
litr[[1]][3,"x"] <- 700000
## Recompute the trajectory
litr <- rec(litr)
## Note that descriptive statistics have changed (e.g. dx)
head(litr[[1]])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.