R/aggregate_landings.R
aggregate_landings.Rd
Landings data analysed to determine NEGEAR aggregation, MARKET_CODE descriptions analysed over time to determine aggregation all subject to length sample availability. Output document created and a logfile to inform the user what steps were taken during aggregation
aggregate_landings(
channel,
landingsData,
lengthData,
speciesName = NULL,
landingsThresholdGear = 0.9,
nLengthSamples = 1,
pValue = 0.05,
aggregate_to = "YEAR",
borrowLengths = T,
proportionMissing = 0.2,
otherGear = "998",
outputDir = here::here("output"),
outputPlots = F,
logfile = "logFile.txt",
speciesRules = NULL
)
an Object inherited from DBIConnection-class.
This object is used to communicate with the database engine. (see connect_to_database
)
Tidy data frame. Landings by YEAR,QTR,NEGEAR,MARKET_CODE,landings_land,landings_nn,len_totalNumLen,len_numLengthSampls
Tidy data frame. Length data by YEAR,QTR,NEGEAR,MARKET_CODE, LENGTH, NUMLEN
Character string. speciesName for data used. (This is used in plotting only)
Numeric scalar (proportion). Minimum proportion of cumulative landings to avoid aggregation of gear. Default = .9
Numeric scalar. The minimum number of length sample sizes required to avoid combination of data. Default = 1
Numeric scalar. Threshold pvalue for determining significance of ks test for length samples
Character string. Level of aggregation for all MARKET_CODES and gears ("QTR", "YEAR", "SEMESTER", MIX"). Default = YEAR.
Boolean. Return data as is or use algorithm to borrow lengths from neighboring cells (Time and/or space)
Numeric scalar. Proportion of missing samples allowed per YEAR for each MARKET_CODE/GEAR combination). Default = 0.2
Character string. Code to indicate the class for "other Gear". This is the group of gear types that land the species of interest but in small numbers Default = "998"
Character string. Path to output directory (png files saved here)
Boolean. Should plots be created. T or F (Default = F)
Character string. Specify the name for the log file generated describing all decisions made.
List. Containing species specific rules. Default = NULL (Fully automated).
Note: Predefined speciesRules
will be bundled with the package for select species
List of landings and associated length samples
Tibble (n x 8). Aggregated landings data. YEAR, QTR, NEGEAR, MARKET_CODE,landings_land (metric tonnes), landings_nn (# trips), len_totalNumLen (# fish lengths), len_numLengthSamples (# independent samples)
Tibble (m x 8 ). Aggregated length data. YEAR, QTR, NEGEAR, MARKET_CODE, LENGTH (length of fish), NUMLEN (# fish at LENGTH)
All plotting functions will need to be finined/generalized rmd file needs to be created to report all decisions