Learn R Programming

PAMpal (version 1.4.4)

sampleDetector: Subsample Detectors in AcousticStudy

Description

samples either a fraction or fixed number from each detector in each event of an AcousticStudy

Usage

sampleDetector(x, n = 1)

Value

subsampled AcousticStudy x

Arguments

x

AcousticStudy object

n

if less than 1, proportion of rows to sample from each detector. If 1 or more, the number of rows to sample from each detector.

Author

Taiki Sakai taiki.sakai@noaa.gov

Details

Uses slice_sample to do the sampling, n is converted either to prop or n based on its size. Negative values are treated the same as in slice_sample

Examples

Run this code

data(exStudy)
nDetections(exStudy)
halfData <- sampleDetector(exStudy, n=0.5)
# there are odd numbers of rows in some detectors, so less than half
nDetections(exStudy)
oneDetPerDetector <- sampleDetector(exStudy, n=1)
nDetections(exStudy)

Run the code above in your browser using DataLab