sepIdGaps: Separate a set of IDs based on gaps

View source: R/algorithms.R

sepIdGapsR Documentation

Separate a set of IDs based on gaps

Description

A new set of ID levels can be created by separating those given based on a minimum gap in another set of data. This is useful for separating instruments identified only by their ID into separate events in time.

Usage

sepIdGaps(id, gapdata, minGap = 3600 * 24 * 7)

Arguments

id

existing ID levels

gapdata

data matching id with gaps to use as separators

minGap

the minimum "gap" to use in gapdata to create a new ID level

Details

The assumption is that a week is a long time for a tag not to record anything.

Value

A new set of ID levels, named following the pattern that "ID" split into 3 would provided "ID", "ID_2" and "ID_3".

Warning

It is assumed that each vector provides is sorted by gapdata within id. No checking is done, and so it is suggested that this only be used on ID columns within existing, validated trip objects.

See Also

trip

Examples



id <- gl(2, 8)
gd <- Sys.time() + 1:16
gd[c(4:6, 12:16)] <- gd[c(4:6, 12:16)] + 10000
sepIdGaps(id, gd, 1000)



trip documentation built on July 9, 2023, 7:29 p.m.