Given the sampling arguments that are specified in ..._params, e.g., index_params, calculate the super set of fleets, years, and data types that will be needed in the data file of expected values that is generated by the OM.

calculate_data_units(
  index_params = NULL,
  lcomp_params = NULL,
  agecomp_params = NULL,
  calcomp_params = NULL,
  mlacomp_params = NULL,
  wtatage_params = NULL
)

Arguments

index_params

Named lists containing the arguments for sample_index().

lcomp_params

Named lists containing the arguments for sample_lcomp().

agecomp_params

Named lists containing the arguments for sample_agecomp().

calcomp_params

Named lists containing the arguments for sample_calcomp().

mlacomp_params

Named lists containing the arguments for sample_mlacomp().

wtatage_params

Named lists containing the arguments for sample_wtatage().

Value

A list with the following three elements:

  • fleets,

  • years, and

  • types.

Note

A superset by nature is larger than the individual sets used to create it (unless all sampling arguments are identical), so that the returned list will created some unnecessary combinations. This was done intentionally for simplicity but may be changed later.

See also

See further examples in clean_data and change_data

Author

Cole Monnahan

Examples

## Only one fleet
calculate_data_units(lcomp_params = list(fleets = 1, years = c(3, 4, 6)))
#> $fleets
#> [1] 1
#> 
#> $years
#> [1] 3 4 6
#> 
#> $types
#> [1] "len"
#> 
## Add new fleet
morefleets <- calculate_data_units(
  lcomp_params = list(fleets = 1, years = c(3, 4, 6)),
  agecomp_params = list(fleets = 2, years = 5)
)
# \dontshow{
testthat::expect_equal(morefleets[["years"]], 3:6)
# }
## Add length or age if missing and conditional-age-at-length is included
test <- mapply(calculate_data_units,
  SIMPLIFY = FALSE,
  lcomp_params = list(NULL, list(fleets = 1, years = 1:10)),
  agecomp_params = list(NULL, NULL),
  MoreArgs = list(calcomp_params = list(fleets = 1, years = 1:10))
)
# \dontshow{
testthat::expect_equal(sort(test[[1]][["types"]]), c("age", "cal", "len"))
testthat::expect_equal(sort(test[[2]][["types"]]), c("age", "cal", "len"))
# }
rm(test)