filter.AcousticStudy {PAMpal} | R Documentation |
Filter an AcousticStudy or AcousticEvent Object
Description
Apply dplyr-like filtering to the detecitons of an AcousticStudy or AcousticEvent object, with a special case for filtering by species for an AcousticStudy
Usage
## S3 method for class 'AcousticStudy'
filter(.data, ..., .preserve = FALSE)
Arguments
.data |
AcousticStudy or AcousticEvent to filter |
... |
Logical expressions, syntax is identical to filter. There are special cases to filter by environmental variables, species ID, database, or detector name. See details. |
.preserve |
not used |
Details
Most expression provided will be used to filter out detections based on calculated parameters.
If the name of an environmental variable added using matchEnvData,AcousticStudy-method is provided, will filter to only events with environmental variables matching those conditions.
If a provided logical expression uses
"species"
or "Species"
, then events will be filtered using the
species present in the $id
of the species
slot of each event.
If a provided logical expression uses "database"
or "Database"
,
then only events with databases matching the expression in files(.data)$db
will remain
If a provided logical expression uses "detector"
or "Detector"
, then
only detections from detectors with names matching the expression will remain in
events. Any events left with no detections will be removed.
Value
The original .data
object, filtered by the given logical expressions
Author(s)
Taiki Sakai taiki.sakai@noaa.gov
Examples
# create example data
data(exStudy)
exStudy <- setSpecies(exStudy, method='manual', value=letters[1:2])
filterData <- filter(exStudy, peak < 20)
getDetectorData(filterData)$click
filterData <- filter(exStudy, species == 'a')
species(filterData[[1]])