This function calculates species condition from a survdat data pull. Methods derived from Laurel Smith (https://github.com/Laurels1/Condition/blob/master/R/RelConditionEPU.R)
Usage
species_condition(
data,
LWparams = NEesp2::LWparams,
species.codes = NEesp2::species.codes,
by_EPU = TRUE,
by_sex = FALSE,
length_break = NULL,
output = "soe"
)
Arguments
- data
data table. NEFSC survey data generated by 'survdat::get_survdat_data(channel, getBio = TRUE, getLengths = TRUE)'
- LWparams
data table. L-W parameters. Default is from Wigley et al. 2003 from NEesp2::LWparams. Alternative parameters could be used, as long as they were formatted the same as the Wigley parameters.
- species.codes
data table. Species codes (SVSPP) and common names from NEesp2::species.codes
- by_EPU
logical. If TRUE, calculates condition by EPUs specified in the input data, if FALSE, calculates condition for all data combined.
- by_sex
logical. If TRUE, calculates condition by sex. If FALSE, calculates condition across sexes.
- length_break
numeric vector. If not NULL, will calculate condition by length breaks specified in the vector. User must specify minimum and maximum lengths in this parameter, e.g., c(0, 20, 70). If NULL, will not calculate by length groupings.
- output
character. If "soe", returns a data frame of species condition for the State of the Ecosystem report. If "esp", returns a data frame for ESPs. If "full", returns a data frame of all calculated values. Setting by_sex = TRUE or length_break to any value will always return a full dataframe