Learn R Programming

icesAdvice (version 2.1.1)

agesFbar: Age Range for Fbar

Description

Calculate a suitable age range for average fishing mortality (Fbar).

Usage

agesFbar(cn, probs = c(0.1, 0.9), plot = FALSE, main = NULL,
  xlab = NULL, ylab = NULL, col = NULL)

Arguments

cn

a vector, matrix, table, or data frame containing the catch at age as integers or decimal values. Ages are indicated in names if cn is a vector, or in column names if cn is a matrix, table, or data frame.

probs

a vector of probabilities, e.g. c(0.1, 0.9) to calculate the age range that covers 80% of the catch.

plot

whether to indicate the cut points on a bar plot.

main

passed to barplot.

xlab

passed to barplot.

ylab

passed to barplot.

col

passed to barplot.

Value

Vector of two values, the lower and upper age. These can be rounded to construct an Fbar age range.

See Also

gss is an example catch-at-age table.

quantile is the base function to calculate quantiles.

icesAdvice-package gives an overview of the package.

Examples

Run this code
# NOT RUN {
agesFbar(gss)
agesFbar(gss, plot=TRUE)
agesFbar(gss, plot=TRUE, main="Greater silver smelt in 5b and 6a")

# 50% coverage instead of 80%
agesFbar(gss, c(0.25, 0.75))

# Include only the last 20 years
agesFbar(tail(gss, 20))

# Tests
cn1 <- setNames(c(100,400,400,100), 3:6)
cn2 <- setNames(c(99,401,401,99), 3:6)
cn3 <- setNames(c(101,399,399,101), 3:6)
cn4 <- setNames(c(500,400,50,50), 3:6)
cn5 <- setNames(c(50,50,400,500), 3:6)
agesFbar(cn1)
agesFbar(cn2)
agesFbar(cn3)
agesFbar(cn4)
agesFbar(cn5)

# }

Run the code above in your browser using DataLab