is.sd {adehabitatLT}R Documentation

Handling of Trajectories of the Same Duration

Description

is.sd tests whether the bursts of relocations in an object of class ltraj contain the same number of relocations, and cover the same duration ("sd" = "same duration").
sd2df gets one of the descriptive parameters of a regular "sd" trajectory (e.g. "dt", "dist", etc.) and returns a data frame with one relocation per row, and one burst per column.

Usage

is.sd(ltraj)
sd2df(ltraj, what)

Arguments

ltraj

an object of class ltraj

what

a character string indicating the descriptive parameter of the trajectory to be exported

Value

is.sd returns a logical value.
sd2df returns a data frame with one column per burst of relocations, and one row per relocation.

Author(s)

Clement Calenge clement.calenge@ofb.gouv.fr

See Also

set.limits for additional information about "sd" regular trajectories

Examples

## Not run: 
## Takes the example from the help page of cutltraj (bear):
data(bear)

## We want to study the trajectory of the animal at the scale
## of the day. We define one trajectory per day. The trajectory should begin
## at 22H00.
## The following function returns TRUE if the date is comprised between
## 21H00 and 22H00 and FALSE otherwise (i.e. correspond to the
## relocation taken at 21H30)

foo <- function(date) {
     da <- as.POSIXlt(date, "UTC")
     ho <- da$hour + da$min/60
     return(ho>21.1&ho<21.9)
}

## We cut the trajectory into bursts after the relocation taken at 21H30:

bea1 <- cutltraj(bear, "foo(date)", nextr = TRUE)
bea1

## Remove the first and last burst:
bea2 <- bea1[-c(1,length(bea1))]

## Is the resulting object "sd" ?
is.sd(bea2)

## Converts to data frame:
df <- sd2df(bea2, "dist")

## Plots the average distance per hour
meandi <- apply(df[-nrow(df),], 1, mean, na.rm = TRUE)
sedi <- apply(df[-nrow(df),], 1, sd, na.rm = TRUE) / sqrt(ncol(df))
plot(seq(0, 23.5, length = 47),
     meandi,
     ty = "b", pch = 16, xlab = "Hours (time 0 = 22H00)",
     ylab="Average distance covered by the bear in 30 mins",
     ylim=c(0, 500))
lines(seq(0, 23.5, length = 47),
      meandi+sedi, col="grey")
lines(seq(0, 23.5, length = 47),
      meandi-sedi, col="grey")



## End(Not run)

[Package adehabitatLT version 0.3.27 Index]