Learn R Programming

trip (version 1.10.0)

sepIdGaps: 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)

Value

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

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

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.

Details

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

See Also

trip

Examples

Run this code


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)


Run the code above in your browser using DataLab