| Title: | An R package for in-river fish migration and timing calculation |
|---|---|
| Description: | An R package for in-river fish migration and timing calculation. |
| Authors: | person("Bryce", "Mecum", "[email protected]", c("aur", "cre")) |
| Maintainer: | Bryce Mecum <[email protected]> |
| License: | file LICENSE |
| Version: | 0.1 |
| Built: | 2026-05-24 08:56:36 UTC |
| Source: | https://github.com/amoeba/upriver |
Expands the movement parameters to include a 0th and n+1th reach.
expand_parameters(parameters)expand_parameters(parameters)
parameters |
(list) Movement parameters (names: |
(list) Expanded parameters
Calculate median timing given a set of parameters
median_timing(location, arrival, parameters, arrival_position = 0)median_timing(location, arrival, parameters, arrival_position = 0)
location |
(numeric) The location at which you want to calculate median timing. |
arrival |
(data.frame) A data.frame of daily arrivals by proportion. See details. |
parameters |
(list) See |
arrival_position |
(numeric) Defaults 0. Where to start movement. |
#' arrival should be a data.frame describing a set of daily
arrivals of fish at arrival_position as a series of daily proportions.
It should have a column day and a corresponding column
proportion, which should sum to one.
median_timing(1000, data.frame(day=0:40, proportion=dnorm(-20:20, 0, 5)/sum(dnorm(-20:20, 0, 5))), list(rates = 50, distances = 1000))median_timing(1000, data.frame(day=0:40, proportion=dnorm(-20:20, 0, 5)/sum(dnorm(-20:20, 0, 5))), list(rates = 50, distances = 1000))
Calculate an arbitrary timing percentile given a set of parameters
percentile_timing(percentile, location, arrival, parameters, arrival_position = 0)percentile_timing(percentile, location, arrival, parameters, arrival_position = 0)
percentile |
(numeric) An arbitrary timing percentile (between 0 and 1) |
location |
(numeric) The location at which you want to calculate median timing. |
arrival |
(data.frame) A data.frame of daily arrivals by proportion. See details. |
parameters |
(list) See |
arrival_position |
(numeric) Defaults 0. Where to start movement. |
#' arrival should be a data.frame describing a set of daily
arrivals of fish at arrival_position as a series of daily proportions.
It should have a column day and a corresponding column
proportion, which should sum to one.
percentile_timing(0.75, 1000, data.frame(day=0:40, proportion=dnorm(-20:20, 0, 5)/sum(dnorm(-20:20, 0, 5))), list(rates = 50, distances = 1000))percentile_timing(0.75, 1000, data.frame(day=0:40, proportion=dnorm(-20:20, 0, 5)/sum(dnorm(-20:20, 0, 5))), list(rates = 50, distances = 1000))
Calculate positions after ndays has elapsed, given the movement
parameters provided in parameters.
positions(ndays, parameters)positions(ndays, parameters)
ndays |
(numeric) The number of days to calculate positions for. |
parameters |
(list) List with names reaches, rates, distances. See details. |
parameters should be a list with three elements, rates, and
distances, each of equal size.
rates should be a numeric vector of reach-specific daily movement
rates, in whatever unit your analysis needs.
distances should be a numeric vector of reach-specific reach lengths
(end-to-end), in the (ideally) the same or compatible units to the units used
in rates
# Simple upriver movement positions(10, list(rates = 50, distances = 1000)) # Movement with reach-to-reach variation positions(10, list(rates = c(1, 2, 3, 4, 5), distances = c(20, 20, 20, 20, 20)))# Simple upriver movement positions(10, list(rates = 50, distances = 1000)) # Movement with reach-to-reach variation positions(10, list(rates = c(1, 2, 3, 4, 5), distances = c(20, 20, 20, 20, 20)))
Calculates run timing given a set of parameters.
timings(location, arrival, parameters, arrival_position = 0)timings(location, arrival, parameters, arrival_position = 0)
location |
(numeric) The location at which to calculate to run timing. |
arrival |
(data.frame) A data.frame of daily arrivals by proportion. See details. |
parameters |
(list) See |
arrival_position |
(numeric) Defaults 0. Where to start movement. |
arrival should be a data.frame describing a set of daily
arrivals of fish at arrival_position as a series of daily proportions.
It should have a column day and a corresponding column
proportion, which should sum to one.
timings(1000, data.frame(day=0:40, proportion = dnorm(-20:20, 0, 5)/sum(dnorm(-20:20, 0, 5))), list(rates = 50, distances = 1000))timings(1000, data.frame(day=0:40, proportion = dnorm(-20:20, 0, 5)/sum(dnorm(-20:20, 0, 5))), list(rates = 50, distances = 1000))