Several seasonal schemes are available, including Petrale seasons (1 = winter months, 2 else). Most assessments won't require getSeason because it is included in cleanPacFIN. If a specialized season structure is required, getSeason should be run immediately after cleanPacFIN.

getSeason(
  Pdata,
  season_type = -1,
  yearUp = NULL,
  yearDown = NULL,
  plotResults = lifecycle::deprecated(),
  savedir = NULL,
  verbose = TRUE
)

Arguments

Pdata

A data object of biological data created using cleanPacFIN()].

season_type

Specify a numeric value for season type. If negative then all months will be assigned to season 1. If 0 then seasons will be assigned from Pdata$SAMPLE_MONTH, where each month is a unique season. If 1 then seasons are assigned according to methods used for Petrale, where winter months (c(11:12, 1:2)) are season 1 and the remaining months (summer) are assigned to season 2. Please contact the package maintainer should you wish to include an additional seasonal scheme.

yearUp

Used to provide a list of months (i.e., 1:12) for which to adjust the year (Pdata$fishyr) up. For example, if winter months belong to the following year then use yearUp = 11:12.

yearDown

Used to provide a list of months (i.e., 1:12) for which to adjust the year (Pdata$fishyr) down. For example, if winter months belong to the previous year then use yearUp = 1:2.

plotResults

Deprecated. A logical value specifying if plots should or should not be created and shown in the console.

savedir

Directory where output plots should be saved. The default argument is NULL.

verbose

A logical specifying if output should be written to the screen or not. Good for testing and exploring your data but can be turned off when output indicates information that you already know. The printing of output to the screen does not affect any of the returned objects. The default is to always print to the screen, i.e., verbose = TRUE.

Value

An additional column season is added to Pdata. No columns are modified.

Author

Andi Stephens, Kelli F. Johnson

Examples

test <- getSeason(
  data.frame(SAMPLE_MONTH = 1:12, fishyr = rep(1:2, each = 6)),
  verbose = TRUE
)
testthat::expect_true(all(test[, "season"] == 1))
test <- getSeason(Pdata = test, season_type = 1, yearUp = 12)
#> Assigning seasons for winter == 1 (month 11, 12, 1, 2) and summer == 2 month
#> (3-10).
#> Incremented fishyr for months 12 to the next year.
testthat::expect_equivalent(test[test[, "fishyr"] == 3, "season"], 1)