During the field study, the collection of the relocations of a
trajectory may sometimes fail, which results into missing values. The
class ltraj
deal with these missing values, so that it is
recommended to store the missing values in the data *before* the
creation of the object of class ltraj
. For example, GPS
collars often fail to locate the animal, so that the GPS data imported
within R contain missing values. It is recommended to *not remove*
these missing values.
However, sometimes, the data come without any information concerning
the placement 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
(and in the optional attribute
infolocs
). This is the role of the function setNA
.
The relocations in the object of class ltraj
may not have been
collected at exactly identical time lag (e.g. a relocation is
collected at 17H57 instead of 18H00). The function setNA
requires that the imprecision in the timing is at most equal to
tol
. Because of this imprecision, it is necessary to pass a
reference date as argument to the function setNA
. This
reference date is used to determine at which time the missing values
should be placed.
The reference date is chosen so that the rest of the division of
(date.relocations - reference.date) by the time lag dt
is equal
to zero. For example, if it is known that one of the relocations of the
trajectory has been collected on January 16th 1996 at 18H00,
and if the theoretical time lag between two relocations is of one
hour, the date of reference could be (for example) the August 1st 2017
at 05H00, because these two dates are separated by an exact number of
hours (i.e. an exact number of dt
). Therefore, any date
fulfilling this condition could be passed as reference date.
Alternatively, the August 1st 2007 at 05H30 is an uncorrect reference
date, because the number of hours separating these two dates is not an
integer.