This function reads matching MEDITS TA (haul metadata) and
TB (catch numbers) tables for a single survey year, computes the swept
area for each haul, derives haul-level abundance indices expressed as
individuals per \(km^2\), and produces one or more box-plots that summarise the
distribution of those indices by species. The plots are written to the folder
<wd>/Graphs/Abundance/ and a logfile is produced under
<wd>/Logfiles/ with a summary of any quality-control issues
encountered.
check_abundance(ResultDataTA, ResultDataTB, year, wd,
suffix = NULL, distance_unit = "km", min_hauls = 5L)Logical scalar (TRUE if no errors, FALSE otherwise).
Data frame containing at least the columns COUNTRY,
YEAR, MONTH, DAY, HAUL_NUMBER, DISTANCE
(towed length) and WING_OPENING (gear width in metres).
Data frame containing at least COUNTRY, YEAR,
MONTH, DAY, HAUL_NUMBER, GENUS, SPECIES,
TOTAL_NUMBER_IN_THE_HAUL and FAUNISTIC_CATEGORY.
Single numeric value identifying the survey year to analyse.
Writable directory where the function will place Logfiles/
and Graphs/Abundance/.
Optional text appended to the logfile name. When missing a timestamp is used.
Either "km" (default) or "nmi". The
value determines the conversion factor applied to DISTANCE.
Minimum number of valid hauls a species must appear in to be
plotted. Defaults to 5.
W. Zupa.
A swept area is first computed for every haul from TA. The function
then merges TA and TB. Hauls that lack swept area information
or hauls whose total number of individuals is missing (or equal to zero when
not allowed by the faunistic category) are discarded and reported in the
logfile. Species occurring in fewer than min_hauls valid hauls are also
removed. The remaining species are sorted alphabetically and divided into
blocks of 36; one image file is produced for each block so that labels remain
readable even in years with many species.
The function returns TRUE when no data-quality issues were found and
FALSE otherwise.
# \donttest{
wd <- tempdir()
check_abundance(ResultDataTA = RoME::TA,
ResultDataTB = RoME::TB,
year = 2007,
wd = wd)
# }
Run the code above in your browser using DataLab