addHydrophoneDepth: Add Hydrophone Depth Data to an AcousticStudy

View source: R/addHydrophoneDepth.R

addHydrophoneDepthR Documentation

Add Hydrophone Depth Data to an AcousticStudy


Add hydrophone depth to an AcousticStudy or AcousticEvent


addHydrophoneDepth(x, depth = NULL, depthCol = NULL, thresh = 60, ...)



an AcousticStudy to add depth data to


a data frame of depth values to match to data from x. Must have column UTC, and a column containing depth data to be specified by depthCol. If not provided and x is an AcousticEvent or AcousticStudy object, then the depth data will be read from the databases contained in the files slot of x


the name of the column containing depth in the dataframe or database. If left as NULL, will search for a single column containing the word "depth" or "Depth"


maximum time apart in seconds for matching depth to data, if the closest value is more than thresh apart then the depth value will be set to NA


additional arguments for other methods


Depth values will be matched to the data by using data.table's rolling join with roll='nearest'. After the join is done, the time difference between the matched rows is checked and any that are greater than the set threshold are set to NA. This is done to prevent accidentally matching weird things if an incomplete set of depth data is provided.

If x is an AcousticEvent or AcousticStudy, then depth can be omitted and will be read from the databases contained in the files slot of x.


the same data as x, with depth data added. All AcousticEvents will have depth data added to all detector dataframes as column hpDepth


Taiki Sakai


# need to update database file to local directory
db <- system.file('extdata', 'Example.sqlite3', package='PAMpal')
exStudy <- updateFiles(exStudy, db=db, bin=NA, verbose=FALSE)
exStudy <- addHydrophoneDepth(exStudy)

PAMpal documentation built on Aug. 12, 2023, 1:06 a.m.