Create the tables with the geomeans for different time periods. Two tables are produced: one of the smoothed wild and total (total in parentheses) spawners. This function is called from esu_report.Rmd and is not exported. The min.year, max.year, lenbands, nbands, and min.band.points control the look of the table and can be controlled in the call to NWCTrends_report() by passing in geomean.table.control as list. For example list(min.year=1999) to change the min year shown from the minimum in the dataset (the default) to 1999.

geomean_table(
  pops,
  mpg,
  total.fit,
  fracwild.fit,
  min.year = 1990,
  max.year = 2014,
  lenbands = 5,
  min.band.points = 2,
  change.col = c("last.two", "first.last"),
  navalue = " "
)

Arguments

pops

which populations to include in the table

mpg

Population group. Shown in the table.

total.fit

The matrix of total spawner estimates

fracwild.fit

The matrix of fraction wild associated with each total row.

min.year

The minumum year to include in the tables.

max.year

The maximum year to include in the tables. If this is 'mid-band', the rest of the band will be padded with NAs and the band width of the last band will be less than lenbands.

lenbands

How many years in each band. Default is 5-years.

min.band.points

The minimum data points for the geomean to show in a band.

change.col

Either between last 2 bands or 1st and last.

navalue

value to show for NAs

Value

A list with the statesgeomean and rawgeomean data frames (tables).

Details

The code will create bands with lenbands years in each band starting with min.year. If max.year, would lead to a final band with less than lenbands years, then the last band will not have lenbands years. If it has fewer than min.band.points, then the last band will be NA. You will need to properly choose min.year and max.year to get the table to look as you want.

The last column of the tables is the percent change. This can be over the last 2 bands or the first and last bands. The change.col argument determines which it is.

Author

Eli Holmes, NOAA, Seattle, USA. eli(dot)holmes(at)noaa(dot)gov