Skip to content

Methods supporting Lavender et al. (2023). Sex- and length-dependent variation in migration propensity in brown trout. Ecology of Freshwater Fish.

License

Notifications You must be signed in to change notification settings

edwardlavender/eawag-hunziker

Repository files navigation

Migratory propensity in juvenile brown trout

Edward Lavender*, Yannick Hunziker, Darryl McLennan, Philip Dermond, Dominique Stalder, Oliver Selz, Jakob Brodersen

Project Status: Inactive – The project has reached a stable, usable state but is no longer being actively developed; support/maintenance will be provided as time allows. DOI

*This repository is maintained by Edward Lavender (edward.lavender@eawag.ch).

Introduction

This repository contains methods, written in R and organised as an RStudio Project for Lavender et al. (2023). Sex- and length-dependent variation in migratory propensity in brown trout. Ecology of Freshwater Fish. https://doi.org/10.1111/eff.12745

In this project, we studied the migratory propensity of potamodromous brown trout (Salmo trutta) in streams around Lake Lucerne (central Switzerland). In this system, the trout exhibit partial lacustrine–adfluvial migration, with a portion of individuals remaining resident in natal rivers while others migrate into the Lake (where predation risks are higher but growth opportunities are also elevated) for a period of time, before returning to natal streams to overwinter. We captured would-be first-time migrants in streams using electrofishing to study migratory propensity in relation to sex and length. We expected that females, and especially small females, would be more likely to undertake migration than equivalently sized males, and that they would migrate earlier in the season than males. Sampled individuals were measured, sexed using a genetic sex determination method and tagged using passive integrated transponders (PIT), which enabled us to identify migration into the Lake. This repository records how we coupled individual trait-level data (size, sex) with inferred migratory status (migrant, non-migrant) to model migratory propensity.

Description

Dependencies

The project was built in R (version 4.2.3) in RStudio and implements local dependency management using renv. This manages the installation of the dv package for project management (from GitHub), as well as other packages from the Comprehensive R Archive Network. The first time the project is opened, renv can be used to regenerate the local project library, as described in renv.lock (via .Rprofile and renv/activate.R).

Directories

The project follows a standardised structure encouraged by the dv package. The high-level structure was generated via dv::use_template_proj(). The contents as follows:

  1. renv/ implements local dependency management.

  2. data-raw/ contains ‘raw’ data:

    • fish/ contains dataframes that define individual size, sex and migratory status (0, 1) for sampled individuals (assembled by YH) and associated PIT tag data;
    • spatial/ contains supporting spatial datasets, including:
  3. data/ contains processed data and results:

    • fish.rds is the processed fish dataset, from process_data_fish.R (see below);
    • distances-to-lake.rds, migrants.rds, prop_ss.rds and prop_sss.rds are supporting datasets generated by data processing scripts (see below);
    • inst/ contains RStudio Project-management files generated by dv:
      • tree.rds is a record of the project directory tree (as generated by dv::use_template_tree() in dev/01-dev.R, see below);
  4. R/ contains scripts for data processing and analysis:

    • define_* scripts define global parameters and functions:
      • define_global_param.R defines global parameters;
      • define_helpers.R defines helper functions;
    • get_data* scripts get raw datasets:
      • get_data.R copies raw datasets into this Project;
    • process_* scripts implement data processing:
      • process_data_spatial.R processes spatial datasets (namely, stream geometries), to define distances along streams to sampling sections and related variables;
      • process_data_fish.R processes the fish data used for analysis;
    • analyse_* scripts analyse the data and produce figures:
      • analyse_data.R produces summary statistics;
      • analyse_p1 analyses ‘Prediction 1’ (females, and especially small females, should be more likely to undertake migration than males);
      • analyse_p2 analyses ‘Prediction 2’ (females should migrate earlier than equivalently sized males);
  5. dev/ contains project-management scripts.

    • 01-dev.R and 02-clone.R are standard dv scripts:
      • 01-dev.R records project set up and development;
      • 02-clone.R is used to clone the project (see ‘Instructions’);
  6. fig/ contains figures.

  7. doc/ contains supporting documents.

Note that the data-raw/spatial/, data/ (except data/inst/), fig/ and doc directories are not currently provided in the online version of this repository.

Instructions

Follow the steps described below to clone the project and reproduce the workflow.

  1. Clone the project via GitHub. Follow the instructions in dev/02-clone.R to install project packages and create directories:

    • Packages. Open dev/02-clone.R to use renv to regenerate the local project library. Packages can also be manually reinstalled via 02-clone.R. (However, note that package versions may differ in this case.)
    • Directories. Rebuild the project directory tree, via dv::use_template_proj() and dv::use_template_tree().
  2. Source (raw) data via the authors and/or links provided.

  3. Define global parameters via define_global_param.R and define_helpers.R.

  4. Process raw data via process_* scripts.

  5. Implement analysis via analyse_* scripts.

Citation

Lavender, E., Hunziker, Y. et al. (2023). Sex- and length-dependent variation in migratory propensity in brown trout. Ecology of Freshwater Fish. https://doi.org/10.1111/eff.12745


About

Methods supporting Lavender et al. (2023). Sex- and length-dependent variation in migration propensity in brown trout. Ecology of Freshwater Fish.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages