check_abundance: Box-plots of swept-area-standardised abundance indices

View source: R/check_abundance.r

check_abundanceR Documentation

Box-plots of swept-area-standardised abundance indices

Description

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.

Usage

check_abundance(ResultDataTA, ResultDataTB, year, wd,
suffix = NULL, distance_unit = "km", min_hauls = 5L)

Arguments

ResultDataTA

Data frame containing at least the columns COUNTRY, YEAR, MONTH, DAY, HAUL_NUMBER, DISTANCE (towed length) and WING_OPENING (gear width in metres).

ResultDataTB

Data frame containing at least COUNTRY, YEAR, MONTH, DAY, HAUL_NUMBER, GENUS, SPECIES, TOTAL_NUMBER_IN_THE_HAUL and FAUNISTIC_CATEGORY.

year

Single numeric value identifying the survey year to analyse.

wd

Writable directory where the function will place ‘Logfiles/’ and ‘Graphs/Abundance/’.

suffix

Optional text appended to the logfile name. When missing a timestamp is used.

distance_unit

Either "km" (default) or "nmi". The value determines the conversion factor applied to DISTANCE.

min_hauls

Minimum number of valid hauls a species must appear in to be plotted. Defaults to 5.

Details

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.

Value

Logical scalar (TRUE if no errors, FALSE otherwise).

Author(s)

W. Zupa.

Examples


wd <- tempdir()
check_abundance(ResultDataTA = RoME::TA,
               ResultDataTB = RoME::TB,
               year = 2007,
               wd   = wd)


RoME documentation built on April 24, 2026, 1:07 a.m.