1.4 Modifying & filtering detection data

Both the Detections and DetectionsList objects have a number of generics which facilitate the handling of data.

subset can be applied to both Detections and DetectionsList objects.

# Filter PPM tags after 8:00 PM
detlst_sub <- subset(exdata_positioning,
  second >= as.POSIXct("2021-05-08 20:00:00", tz = "CET") & type %in% c("PPM", "PPM_SELF"))  
detlst_sub
## DetectionsList
## 
## Receiver Summary
##                    1     2     3     4     5     6    
## Sync-tag ID        62041 62042 62074 62368 62581 62584
## Sync-tag emissions 119   120   119   120   118   119  
## Tag detections     476   482   458   442   445   349  
## Tags detected      6     6     6     6     6     5    
## 
## Detections Summary
##     Tag-ID     First detection      Last detection   n Detection period (h)
##      62074 2021-05-08 20:04:05 2021-05-09 05:59:56 476                 9.93
##      62368 2021-05-08 20:01:15 2021-05-09 05:55:31 457                 9.90
##      62584 2021-05-08 20:02:09 2021-05-09 05:52:23 439                 9.84
##      62042 2021-05-08 20:03:05 2021-05-09 05:56:37 414                 9.89
##      62041 2021-05-08 20:04:15 2021-05-09 05:58:01 414                 9.90
##      62581 2021-05-08 20:02:41 2021-05-09 05:55:42 380                 9.88
##  PPM-53883 2021-05-08 20:55:51 2021-05-08 21:22:06  72                 0.44

For Detections objects, we can easily subset rows with indexing.

det_1[1:6]
## Telemetry Detections
## Name: 1
## Sync-tag ID: 62041
## Depth: NA
## Coords: (481460.3 m, 6243492 m)
## Sync tag emissions: 1
## Detections: 5
## First detection on: 2021-05-08 18:00:09
## Last detection on: 2021-05-08 18:05:23
## Time zone: CET
##                second millisecond detect_id     type sync_emission
## 1 2021-05-08 18:00:09    427.3985     62074      PPM         FALSE
## 2 2021-05-08 18:00:38    772.6640     62042      PPM         FALSE
## 3 2021-05-08 18:00:48    244.0411     62584      PPM         FALSE
## 4 2021-05-08 18:01:03    878.7920  PPM_SELF PPM_SELF          TRUE
## 5 2021-05-08 18:02:21    749.5333     62368      PPM         FALSE
## 6 2021-05-08 18:05:23    948.8101     62074      PPM         FALSE

We can also apply offsets to the clock values.

# Subtract 10.5 seconds from the first 3 detection times
det_1[1:3] <- det_1[1:3] - 10.5
head(det_1)
## Telemetry Detections
## Name: 1
## Sync-tag ID: 62041
## Depth: NA
## Coords: (481460.3 m, 6243492 m)
## Sync tag emissions: 1
## Detections: 5
## First detection on: 2021-05-08 17:59:58
## Last detection on: 2021-05-08 18:05:23
## Time zone: CET
##                second millisecond detect_id     type sync_emission
## 1 2021-05-08 17:59:58    927.3985     62074      PPM         FALSE
## 2 2021-05-08 18:00:28    272.6640     62042      PPM         FALSE
## 3 2021-05-08 18:00:37    744.0411     62584      PPM         FALSE
## 4 2021-05-08 18:01:03    878.7920  PPM_SELF PPM_SELF          TRUE
## 5 2021-05-08 18:02:21    749.5333     62368      PPM         FALSE
## 6 2021-05-08 18:05:23    948.8101     62074      PPM         FALSE