2.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
sec_start <- as.POSIXct("2021-05-08 20:00:00", tz = "CET")
type_in <- c("PPM", "PPM_SELF")
detlst_sub <- subset(exdata_positioning,
second >= sec_start & type %in% type_in)
detlst_sub## DetectionsList
## 1, 2, 3, 4, 5, 6
For Detections objects, we can easily subset rows with indexing.
## 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: 144
## Detections: 651
## First detection on: 2021-05-08 17:59:58
## Last detection on: 2021-05-09 05:59:56
## 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