adjust.duplicateTimes {trip}R Documentation

Adjust duplicate DateTime values

Description

Duplicated DateTime values within ID are adjusted forward (recursively) by one second until no duplicates are present. This is considered reasonable way of avoiding the nonsensical problem of duplicate times.

Usage

adjust.duplicateTimes(time, id)

Arguments

time vector of DateTime values
id vector of ID values, matching DateTimes that are assumed sorted within ID

Details

This function is used to remove duplicate time records in animal track data, rather than removing the record completely.

Value

The adjusted DateTime vector is returned.

Warning

I have no idea what goes on at CLS when they output data that are either not ordered by time or have duplicates. If this problem exists in your data it's probably worth finding out why.

Author(s)

Michael D. Sumner

References

http://staff.acecrc.org.au/~mdsumner/

See Also

readArgos

Examples

    ## DateTimes with a duplicate within ID
    tms <- Sys.time() + c(1:6, 6, 7:10) *10 
    id <- rep("a", length(tms))
    range(diff(tms))
    
    ## duplicate record is now moved one second forward
    tms.adj <- adjust.duplicateTimes(tms, id)
    range(diff(tms.adj))

[Package trip version 1.1-2 Index]