knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

flapper

Routines for the analysis of passive acoustic telemetry data, including the reconstruction of fine-scale movement paths and emergent patterns of space use. https://edwardlavender.github.io/flapper/

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Lifecycle: experimental CRAN status

Warning The flapper package has been superseeded by patter, which is simpler, faster and better tested. patter will be made available late 2023. Please get in touch to support beta testing.

flapper is an R package which provides tools for passive acoustic telemetry data. The package has been particularly motivated by the collection of acoustic and archival data from a Critically Endangered elasmobranch, the flapper skate (Dipturus intermedius), off the west coast of Scotland where a static passive acoustic telemetry array was established to examine the movements of individuals within a Marine Protected Area. flapper has been designed to complement existing packages for the analysis of these data (e.g. VTrack, glatos and fishtrack3d and actel), with a particular focus on the provision of movement modelling methods for passive acoustic telemetry systems that permit the reconstruction of fine-scale movement paths and emergent patterns of space use. To this end, flapper contains functions in the following themes:

flapper: An R package of routines for the analysis of passive acoustic telemetry data, especially the reconstruction of fine-scale movement paths and emergent patterns of space use. Inserted sample depth and acoustic time series were collected as part of the Movement Ecology of Flapper Skate project by Marine Scotland Science and NatureScot. The insert of the flapper skate is also courtesy of this project. The bathymetry data are sourced from the Ireland, Northern Island and Scotland Hydrographic survey (Howe et al., 2014. Earth Environ. Sci. Trans. R. Soc. Edinburgh 105, 273–284.). Plots were produced using the prettyGraphics package.

For full package details, vignettes and illustrated examples, go to https://edwardlavender.github.io/flapper/.

Highlights

The main highlights of the package are the provision of routines for the rapid calculation of biologically meaningful distances in areas with complex barriers to movement (e.g., coastline) alongside algorithms (most of which are exclusive to flapper) for reconstructing movements and patterns of space use from discrete detections at receivers, especially:

Installation

Warning The flapper package has been superseeded by patter, which is simpler, faster and better tested. patter will be made available late 2023. Please get in touch to support beta testing.

This package requires R version ≥ 4.0. You can check your current version with R.version.string. Subsequent installation steps (may) require the devtools and pkgbuild packages, which can be installed with install.packages(c("devtools", "pkgbuild")). On Windows, package building requires Rtools. You can check whether Rtools is installed with pkgbuild::has_rtools(). If Rtools is not installed, it is necessary to download and install the appropriate version of Rtools before proceeding by following the instructions here.

Four packages (prettyGraphics, Tools4ETS, fasterRaster and glatos) are required or suggested from GitHub repositories (since they are not currently available from CRAN). These can be installed during the installation process (see below), but it is safer to install them sequentially as follows:

devtools::install_github("edwardlavender/prettyGraphics") # required
devtools::install_github("edwardlavender/Tools4ETS")      # required
devtools::install_github("adamlilith/fasterRaster")       # suggested
devtools::install_github("ocean-tracking-network/glatos") # suggested

To install these packages with their vignettes, add dependencies = TRUE and build_vignettes = TRUE as arguments to the code above (see ?devtools::install_github or ?devtools::install_url for further information). Then, you can install the development version of flapper from GitHub as shown below:

devtools::install_github("edwardlavender/flapper", dependencies = TRUE, build_vignettes = TRUE)

The dependencies = TRUE argument will also install any suggested packages, which are required by some functions/examples and to build vignettes (which will be added to the package in due course). To access the vignettes, use vignette("flapper_intro", package = "flapper") for a general introduction to the package. Note that vignettes have not yet been added to the package.

Example datasets

A key feature of the flapper package is that most functions are designed to be implemented using standard object types (e.g., dataframes and matrices) rather than package-specific object classes. For simplicity, flapper makes some assumptions about variable names that follow a consistent and logical structure (e.g., individual IDs are given as individual_id and receiver IDs are given as receiver_id) but, notwithstanding this framework, this structure means that the functions in the package are accessible and straightforward to use.

Functions are illustrated using simulated data and the following sample data collected from flapper skate off the west coast of Scotland:

These example datasets were collected by Marine Scotland Science and NatureScot as part of the Movement Ecology of Flapper Skate project and belong to these organisations. If you wish to use these data, please contact Marine Scotland Science and NatureScot for further information.

Data processing tools

A number of functions facilitate the acquisition, assembly, processing and checking of passive acoustic telemetry time series:

Spatial tools

A number of functions facilitate spatial operations that support common tasks and modelling algorithms:

Distance calculations

Some functions facilitate standard distance calculations using Euclidean distances:

Often, Euclidean distances may not be a suitable representation of distance. This is especially the case for coastal benthic/demersal species in bathymetrically complex environments, for which navigation between locations may require movement over hilly terrain and around coastline. For this reason, a number of functions facilitate the calculation of shortest paths/distances:

Detection statistics

A number of functions facilitate the calculation of detection statistics, including those related to sampling effort and to detections of individuals:

Movement metrics

Building on the analysis of detection time series, some functions (get_mvt_*()) provide movement metrics:

Modelling algorithms

The main thrust of flapper is the implementation of algorithms designed to reconstruct fine-scale movement paths and emergent patterns of space use in passive acoustic telemetry systems.

The centres of activity (COA) algorithm

Centres of activity (COA) are one of the most widely used metrics for the reconstruction of patterns of space use from passive acoustic telemetry data. Several methods have been developed to calculate COAs, but the mean-position algorithm is the commonest. To generate estimates of space use, COAs are usually taken as point estimates from which UDs (typically kernel UDs or KUDs) are estimated. flapper facilitates the implementation of this approach with the following functions:

The flapper family of algorithms

Alongside the COA algorithm, this package introduces the flapper of algorithms for the inferring patterns of space use.

The 'flapper' family of algorithms. The acoustic-container (AC) branch utilises acoustic data (and/or ancillary information) to reconstruct the set of possible locations for an individual through time. The particle filtering (PF) branch refines this set via the implementation of a particle simulation and filtering approach for the reconstruction of possible movement paths.

AC/DC branch algorithms

The depth-contour (DC) algorithm

The depth-contour (DC) algorithm is the simplest. Whereas the COA approach only makes use of detections, the DC approach only uses depth observations. Specifically, this algorithm uses observed depths (± some error) to define the subset of possible locations of each individual within a defined area: for pelagic species, tagged individuals must be in an area where the seabed depth is at least as deep as the observed depth; for benthic/demersal species, tagged individuals must be in an area where the seabed depth is close to the observed depth. This is implemented via dc(). The 'quick' depth-contour (DCQ) algorithm, implemented via dcq(), uses a modified version of this algorithm for quicker run times.

The acoustic-container (AC) algorithm(s)

The flapper family-equivalent of the COA algorithm is the acoustic-container (AC) algorithm. This approach represents the information from acoustic detections in the form of acoustic containers, which contract and expand in line with our uncertainty in an individual's location when it is detected and in the gaps between detections. The acoustic-container depth-contour (ACDC) algorithm combines the AC and DC algorithms, using passive acoustic telemetry data to inform the area within which depth contours are most likely to be found. These algorithms are implemented with the ac*() family of functions:

AC/DC post-processing and analysis

The AC-branch functions (ac(), dc() and acdc()) all return objects of class acdc_archive. These can be processed and analysed using several key functions:

Particle filtering branch algorithms

Each algorithm (AC, DC and ACDC) can be extended through incorporation of a movement model to reconstruct movement paths over a surface that are consistent with the observations (and model assumptions). The resultant algorithms are termed the ACPF, DCPF and ACDCPF algorithms. The approach is implemented via a particle simulation and filtering process provided by the pf*() family of functions:

Simulation tools

flapper provides joined-up routines for the simulation of acoustic arrays, movement paths and detections at receivers:

To evaluate the performance of alternative algorithms for reconstructing patterns of space use under different array designs, movement models and detections models, eval_by_kud() compares patterns of space use reconstructed from simulated and estimated movement paths using KUDs.

Parallelisation routines

Parallelisation in flapper is facilitated by the cl_*() function family:

Resources

For an overview of the flapper algorithms, see: Lavender, E., Biber, S., Illian, J., James, M., Wright, P. J., Thorburn, J., & Smout, S. (2023). An integrative modelling framework for passive acoustic telemetry. Methods in Ecology and Evolution, 00, 1–13. https://doi.org/10.1111/2041-210X.14193

For further code examples, see:

For further information of the flapper package, see:

Disclaimers and troubleshooting

flapper is a new, proof-of-concept R package. It was written to support the implementation of a novel, mathematical framework for movement modelling in passive acoustic telemetry systems in our study system in Scotland. The functions are extensively documented but the package is at an early stage of evolution. All routines are experimental. Researchers interested in using the package are encouraged to get in touch while the methods and package remain at an early stage of evolution (edward.lavender@eawag.ch).

Associated packages

Citation

To cite package flapper in publications, please use Lavender et al. (2023). For residency analyses, please also cite Lavender et al. (2021).

Lavender, E. et al. (2021). Movement patterns of a Critically Endangered elasmobranch (Dipturus intermedius) in a Marine Protected Area. Aquatic Conservation: Marine and Freshwater Ecosystems, 32, 348–365. https://doi.org/10.1002/aqc.3753

Lavender, E. et al. (2023). An integrative modelling framework for passive acoustic telemetry. Methods in Ecology and Evolution. https://doi.org/10.1111/2041-210X.14193

For the shortest-path routines, please also consider citing cppRouting:

Larmet V (2022). cppRouting: Algorithms for Routing and Solving the Traffic Assignment Problem. R package version 3.1. https://CRAN.R-project.org/package=cppRouting.




edwardlavender/flapper documentation built on Jan. 22, 2025, 2:44 p.m.