subsampleDetections {banter}R Documentation

Subsample Detections

Description

Extract a random subsample of detections for each event and detector.

Usage

subsampleDetections(data, n)

Arguments

data

a detector data.frame or list of detector data.frames.

n

a value giving the number (n >= 1) or fraction (n between 0 and 1) of detections per event per detector to select. Detections are randomly selected without replacement. If n is greater than the number of detections in an event, all detections for that event will be retained.

Value

a detector data.frame or list of detector data.frames with no more than n detections per event per detector.

Author(s)

Eric Archer eric.archer@noaa.gov

References

Rankin, S., Archer, F., Keating, J. L., Oswald, J. N., Oswald, M. , Curtis, A. and Barlow, J. (2017), Acoustic classification of dolphins in the California Current using whistles, echolocation clicks, and burst pulses. Marine Mammal Science 33:520-540. doi:10.1111/mms.12381

Examples

data(train.data)

# initial number of detections per event per detector
sapply(train.data$detectors, function(x) table(x$event.id))

# select half of all detectors
detect.half <- subsampleDetections(train.data$detectors, 0.5)
sapply(detect.half, function(x) table(x$event.id))

# select 20 detections
detect.20 <- subsampleDetections(train.data$detectors, 20)
sapply(detect.20, function(x) table(x$event.id))

# select 10 detections fro 'ec' detector
ec.10 <- subsampleDetections(train.data$detectors$ec, 10)
table(ec.10$event.id)


[Package banter version 0.9.6 Index]