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.

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

Value

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

Details

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

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

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)
#> [1] "1" "1" "1" "1_2" "1_2" "1_2" "1_2" "1_2" "2" "2" "2" "2_2" #> [13] "2_2" "2_2" "2_2" "2_2"