Calvin Beale
FishDiveR logo: a manta ray carrying a tag

FishDiveR

A free, open-source R package that classifies aquatic animal behaviour from tag depth data. It turns months of depth records into a small number of daily behaviour types you can count, map and compare.

Illustrative simulated depth record over eight days, each day coloured by its behaviour cluster0 m100 m200 mDay 1Day 2Day 3Day 4Day 5Day 6Day 7Day 8
Illustration: a simulated depth record, with each 24-hour day coloured by behaviour cluster in the style of FishDiveR’s output. Shaded bands are night.
97.7%of simulated days assigned to their true behaviour
Many speciestested, including oceanic manta rays, whale sharks, Atlantic cod, sawfish, bluefin tuna and scalloped hammerheads
83.9%consistency maintained when sampling was reduced from 1 to 15 minutes

Percentages from the peer-reviewed methods paper in Movement Ecology (2026), which presents four case-study species.

What it does

Tags such as pop-up satellite archival tags record depth every few seconds or minutes for months at a time. Most studies still summarise those records as time-at-depth histograms, which lose the timing and rhythm of how an animal moves through the water column.

FishDiveR keeps that information. It splits a depth record into 24-hour days and describes each day in two ways: depth statistics, such as mean depth, vertical speed and day–night differences, and wavelet analysis, which picks out repeating patterns from five-minute cycles up to the daily cycle. Principal component analysis condenses the wavelet results, and k-means clustering then groups days with similar behaviour.

The result is a set of behaviour clusters, such as diel vertical migration, reverse diel migration, bounce diving or near-surface activity, with every day of the record assigned to one, ready for plotting and further analysis.

How it works, in four steps

Each 24-hour day, midnight to midnight in local time, becomes one row of data.

  1. Continuous wavelet transform. Finds how strongly the depth record oscillates at each period, from minutes to a day, at every point in time. Unlike a Fourier transform, it copes with behaviour that changes through the record.
  2. Daily statistics. Summarises the wavelet for each day and period, and calculates depth statistics from the record itself: mean and maximum depth, vertical speed, time near the surface and, optionally, differences between day and night.
  3. Principal component analysis. Condenses the many, closely related wavelet statistics into a few components.
  4. K-means clustering. Groups the days into behaviour clusters using the components and depth statistics together. Elbow and silhouette plots help choose the number of clusters.

The tutorial runs every step on the example tag that comes with the package, with the code and real output.

Documentation

Tutorial: from tag archive to behaviour clusters
The full workflow in R, step by step, with how to choose each setting and a reference list of every function.
The point-and-click app
Run the whole analysis in your browser without writing code. Your data stay on your computer.
Large, high-frequency records
Estimating memory, thinning 1-second records without aliasing, and plotting millions of points fast.
Function reference
Every function and argument, on the package’s documentation site.

Install

# From CRAN
install.packages("FishDiveR")

# Development version from GitHub, with the app and the latest features
# install.packages("remotes")
remotes::install_github("calvinsbeale/FishDiveR")

Please report problems on GitHub.

Common questions

What kind of tag data can FishDiveR analyse?

Any depth record with a constant sampling interval, saved as a CSV file with a date-time column and a depth column. That includes data from recovered pop-up satellite archival tags, archival tags and time-depth recorders (TDRs).

The current version is built for continuous records. Support for records with gaps, common in satellite-transmitted data, is planned.

Which species does it work for?

The method was developed for gill-breathing aquatic animals. The methods paper presents case studies of an oceanic manta ray (Mobula birostris), a whale shark (Rhincodon typus), Atlantic cod (Gadus morhua) and a largetooth sawfish (Pristis pristis). The package has also been tested on other species, including green sawfish, bluefin tuna and scalloped hammerheads.

How often does depth need to be recorded?

Five-minute sampling or finer is recommended, and more active species need finer sampling. The shortest cycle the wavelet can analyse is twice the sampling interval. In the methods paper, results stayed 83.9% consistent when sampling was reduced from 1 to 15 minutes.

How many days of data do I need?

At least three full days, midnight to midnight, for the package to run. Meaningful clusters need considerably more: the more varied the animal’s behaviour, the more days are needed.

Do I need to know R?

A little R helps, but the development version includes a point-and-click app that runs the whole workflow in your browser, without code.

Are my data uploaded anywhere?

No. The package and the app both run on your own computer, so your data never leave your machine.

My tag records every second. Will it cope?

Yes, with some care: the wavelet of a long 1-second record can need tens of gigabytes of memory. Large, high-frequency records shows how to estimate the memory first and reduce it with thin_archive().

What about time zones?

Days are split at local midnight, so give the time zone the animal was in. Time zones with daylight saving are not supported, as the clock changes create days of 23 and 25 hours.

Does it use temperature data?

Not currently. A temperature column can be included, and it does not affect the results.

Can I analyse several tags together?

Yes. Clustering several tags together finds behaviours shared between individuals. Use the same wavelet settings for every tag, and ideally the same sampling interval. See analysing several tags together.

Can you run the analysis for me?

Yes. See analysis services, or the manta ray data collaboration if you hold manta ray tag data.

How to cite FishDiveR

If you use FishDiveR in published work, please cite the methods paper:

Beale, C. S., Hounslow, J. L., Beer, A. J. E., Braccini, M., Erdmann, M. V., Harry, A., Loneragan, N. R., Meekan, M., Newman, S. J., Righton, D., Runtuboy, F., Travers, M. J., Wright, S., & Gleiss, A. C. (2026). FishDiveR: wavelet analyses and machine learning provide robust classification of animal behaviour from time-depth data. Movement Ecology, 14, 8. doi.org/10.1186/s40462-025-00622-w

BibTeX:

@article{Beale2026FishDiveR,
  title   = {{FishDiveR}: wavelet analyses and machine learning provide robust
             classification of animal behaviour from time-depth data},
  author  = {Beale, Calvin S. and Hounslow, Jenna L. and Beer, Angela J. E. and
             Braccini, Matias and Erdmann, Mark V. and Harry, Alastair and
             Loneragan, Neil R. and Meekan, Mark and Newman, Stephen J. and
             Righton, David and Runtuboy, Ferawati and Travers, Michael J. and
             Wright, Serena and Gleiss, Adrian C.},
  journal = {Movement Ecology},
  year    = {2026},
  volume  = {14},
  number  = {1},
  pages   = {8},
  doi     = {10.1186/s40462-025-00622-w}
}

Links

Questions about FishDiveR?

I created and maintain the package. If you’d like help using it, or would rather I ran the analysis for you, see analysis services or email me.

[email protected]