top_coh: Create text describing the top 'num_cohorts' cohorts by year...

View source: R/utils-top-coh.R

top_cohR Documentation

Create text describing the top num_cohorts cohorts by year and percentage as a sentence

Description

Create text describing the top num_cohorts cohorts by year and percentage as a sentence

Usage

top_coh(
  model = NULL,
  yr = year(Sys.Date()),
  num_cohorts = 3,
  decimals = 0,
  cap = TRUE,
  use_catage = FALSE,
  fleet = 1,
  ret_cohort = NA
)

Arguments

model

The model as returned from create_rds_file()

yr

the year to calculate the cohort catch percentages for

num_cohorts

The top num_cohorts cohorts will be mentioned in the sentence

decimals

The number of decimal points to use

cap

Logical. Capitalize the first word in the sentence?

use_catage

Logical. If TRUE, use the model$extra_mcmc$catage_median object which are the estimates. If FALSE, use the model$dat$agecomp object which are the input data

fleet

A integer value allowing the selection of a given fleet, where fleet = 1, the default, selects the fishery data. This is only used for the case where use_catage is FALSE. If use_catage is TRUE, fleet will be ignored and fishery data are used

ret_cohort

If not NA, filter out this cohort from the result and return the proportion for it for year yr

Details

top_coh(base_model, 2020, 2022, 2) produces: "The 2020 cohort was the largest (33\%), followed by the 2016 cohort (24\%)"

Value

Text describing the top num_cohorts cohorts by year and percentage as a sentence


pacific-hake/hake-assessment documentation built on Nov. 8, 2024, 1:16 p.m.