Skip to contents

Present the current weight at length (mean +/- 1 s.d., with lengths binned at 1 cm increments) with historical survey observations plotted as the range of past observations as well the historical mean +/- 1 s.d. To be consistent with the MACE standard approach, only classes with >= 5 fish are plotted; in cases with < 5 fish the estimated weight at length based on a linear regression is used instead (see De Robertis and Williams 2008: Weight–Length Relationships in Fisheries Studies: The Standard Allometric Model Should Be Applied with Caution.).

Usage

plot_weight_at_length(
  survey_vector,
  length_vector,
  weight_vector,
  current_survey
)

Arguments

survey_vector

a vector identifying the survey a given length and weight value is from. This vector must be equal in length to length_vector and weight_vector.

length_vector

A vector of fish lengths (units are assumed to be cm). This vector must be equal in length to survey_vector and weight_vector.

weight_vector

A vector of fish weights (units are assumed to be kg). This vector must be equal in length to survey_vector and length_vector.

current_survey

Identify which survey is the current survey so that it can be highlighted in plots (and removed from the historical comparison).

Value

A list with 3 items: Item 1 = A ggplot object Item 2 = A dataframe of the current survey weight at length Item 3 = A dataframe summarizing the historical survey weight at length

Examples

if (FALSE) { # \dontrun{
# load example data
library(MACEReports)
data("pollock_length_weight_age_data")

# gather plot and summary dataframes
pollock_wt_len <- plot_weight_at_length(
survey_vector = pollock_length_weight_age_data$SURVEY,
 length_vector = pollock_length_weight_age_data$FORK_LENGTH,
 weight_vector = pollock_length_weight_age_data$ORGANISM_WEIGHT,
  current_survey = 202104)

# show the plot
pollock_wt_len[[1]]
# get the current survey summary
current_survey_pollock_wt_len <- pollock_wt_len[[2]]
# and the historical survey summary
historical_survey_pollock_wt_len <- pollock_wt_len[[3]]
} # }