R/typeII2typeI.r

typeII2typeI <- function(x)
{
    if (!inherits(x, "ltraj"))
        stop("x should be of class \"ltraj\"")
    if (!attr(x, "typeII"))
        stop("x should be of type II (time recorded)")
    res <- lapply(x, function(i) {i$date <- 1:nrow(i);return(i)})
    class(res) <- c("ltraj","list")
    attr(res, "typeII") <- FALSE
    attr(res, "regular") <- FALSE
    return(res)
}
ClementCalenge/adehabitat documentation built on May 6, 2019, 12:02 p.m.