| Title: | Biological Indicators and Indices for MEDITS Survey Data |
|---|---|
| Description: | Supports the standardized analysis of Mediterranean International Bottom Trawl Survey (MEDITS) data and the calculation of biological indicators for selected species and population components. The package provides functions to estimate abundance and biomass indices, analyse size structure and length frequency distributions, derive sex ratio and maturity related metrics, explore spatial patterns, and assess temporal trends across surveys. Developed for integration within the Regional Database for Fisheries (RDBFIS) framework, it is intended to work on quality checked input data and to produce reproducible outputs that can support monitoring, comparative analyses among Geographical Sub-Areas (GSAs) and countries, and fishery management. |
| Authors: | Walter Zupa [aut, cre], Loredana Casciaro [rev], Cosmidano Neglia [rev], Isabella Bitetto [rev], Maria Teresa Spedicato [aut] |
| Maintainer: | Walter Zupa <[email protected]> |
| License: | GPL-3 |
| Version: | 0.6.4 |
| Built: | 2026-05-29 12:54:31 UTC |
| Source: | https://github.com/cran/BioIndex |
Aggregate TA, TB, and TC MEDITS tables across a user-defined set of Geographical Sub-Areas (GSAs), and update the associated stratification objects accordingly.
aggregate_gsas( ta, tb, tc, gsas, strata_scheme = BioIndex::strata_scheme, stratification = BioIndex::stratification )aggregate_gsas( ta, tb, tc, gsas, strata_scheme = BioIndex::strata_scheme, stratification = BioIndex::stratification )
ta |
A data frame containing the MEDITS |
tb |
A data frame containing the MEDITS |
tc |
A data frame containing the MEDITS |
gsas |
A numeric or character vector of GSA codes to be aggregated. |
strata_scheme |
A data frame describing the depth-strata scheme for the
selected GSAs. Defaults to |
stratification |
A data frame containing the stratification information
for the selected GSAs. Defaults to |
This function filters the input TA, TB, and TC tables to retain only the
selected GSAs, concatenates the original AREA and HAUL_NUMBER
values to create unique haul identifiers across GSAs, and replaces the
AREA field with a single aggregated GSA code obtained by collapsing
the selected GSA values into one string. The same aggregation is applied to
the stratification and strata_scheme tables.
The function performs three main operations:
Checks that all requested GSAs are present in the AREA column
of the input ta, tb, and tc tables.
Filters the three MEDITS tables to the selected GSAs and updates
HAUL_NUMBER by prefixing it with the original AREA value,
ensuring uniqueness after aggregation.
Filters and updates the stratification and
strata_scheme tables so that all selected GSAs are represented under
a single aggregated GSA code.
The aggregated GSA code is created using paste(gsas, collapse = "").
For example, c(17, 18) becomes "1718".
A list with five elements:
The filtered and aggregated TA table.
The filtered and aggregated TB table.
The filtered and aggregated TC table.
The filtered and updated stratification table.
The filtered and updated strata_scheme table.
# Use internal data data("strata_scheme", package = "BioIndex") data("stratification", package = "BioIndex") data("TA", package = "BioIndex") data("TB", package = "BioIndex") data("TC", package = "BioIndex") d <- aggregate_gsas( ta = TA, tb = TB, tc = TC, gsas = 10, strata_scheme = BioIndex::strata_scheme, stratification = BioIndex::stratification ) ta_agg <- d[[1]] tb_agg <- d[[2]] tc_agg <- d[[3]] stratification_agg <- d[[4]] strata_scheme_agg <- d[[5]]# Use internal data data("strata_scheme", package = "BioIndex") data("stratification", package = "BioIndex") data("TA", package = "BioIndex") data("TB", package = "BioIndex") data("TC", package = "BioIndex") d <- aggregate_gsas( ta = TA, tb = TB, tc = TC, gsas = 10, strata_scheme = BioIndex::strata_scheme, stratification = BioIndex::stratification ) ta_agg <- d[[1]] tb_agg <- d[[2]] tc_agg <- d[[3]] stratification_agg <- d[[4]] strata_scheme_agg <- d[[5]]
Computes the Age-Length Key (ALK) from biological samples, a crucial parameter for converting length distributions into age classes and analyzing stock growth dynamics.
ALK( ta, te, sp, GSA, country = "all", nyears = NA, wd = NA, save = TRUE, verbose = FALSE )ALK( ta, te, sp, GSA, country = "all", nyears = NA, wd = NA, save = TRUE, verbose = FALSE )
ta |
MEDITS or MEDITS-like TA table |
te |
MEDITS or MEDITS-like TE table |
sp |
species RUBIN code (MEDITS format, e.g. "MERLMER") |
GSA |
reference GSA for the analysis |
country |
reference country |
nyears |
number of years of the time series to be considered in the analysis |
wd |
path of the working directory |
save |
boolean. If TRUE the outputs are saved in the local folder |
verbose |
boolean. If TRUE messages are promted in the console |
A data.frame representing the Age-Length Key.
Estimation of ALK
ALKf(te, sp, GEAR, GSA, country = NA, years = 5, wd = NA, save = TRUE)ALKf(te, sp, GEAR, GSA, country = NA, years = 5, wd = NA, save = TRUE)
te |
MEDITS or MEDITS-like TE table |
sp |
species RUBIN code (MEDITS format, e.g. "MERLMER") |
GEAR |
type of gear reported in the corresponding TA file |
GSA |
reference GSA for the analysis |
country |
reference country |
years |
number of years to be considered in the analysis |
wd |
path of the working directory |
save |
boolean. If TRUE the outputs are saved in the local folder |
A data.frame representing the Age-Length Key for females.
BioIndex is an R package designed to support the standardized analysis of MEDITS trawl survey data and the calculation of biological indicators for selected species and population components.
BioIndex( ta, tb, tc, sspp, rec_threshold, spaw_threshold, haul_threshold = 30, sexes = "all", depth, GSA, country = "all", map_lim, depth_lines = c(10, 200, 800), strata = BioIndex::strata_scheme, stratification_tab = BioIndex::stratification, resolution = NA, buffer = 0.1, wd = NA, zip = TRUE, save = TRUE, verbose = TRUE )BioIndex( ta, tb, tc, sspp, rec_threshold, spaw_threshold, haul_threshold = 30, sexes = "all", depth, GSA, country = "all", map_lim, depth_lines = c(10, 200, 800), strata = BioIndex::strata_scheme, stratification_tab = BioIndex::stratification, resolution = NA, buffer = 0.1, wd = NA, zip = TRUE, save = TRUE, verbose = TRUE )
ta |
data frame of the TA table in the MEDITS format |
tb |
data frame of the TB table in the MEDITS format |
tc |
data frame of the TC table in the MEDITS format |
sspp |
reference species for the analysis |
rec_threshold |
cutoff threshold for recruits (reported in mm) |
spaw_threshold |
cutoff threshold for spawners (reported in mm) |
haul_threshold |
minimum number of individuals to be used in estimation of the spatial indicators |
sexes |
reference sex for the analysis |
depth |
reference depth range |
GSA |
reference GSA for the analysis |
country |
reference country |
map_lim |
coordinates limits for the maps |
depth_lines |
depth contours to be plotted in the maps (3 values allowed, e.g c(50,200,800)) |
strata |
data frame of the reference strata for the study area |
stratification_tab |
data frame of the stratification scheme |
resolution |
resolution of the depth line |
buffer |
buffer around the map |
wd |
path of the working directory |
zip |
boolean. If TRUE the results are stored in a zip file into the working directory |
save |
boolean. If TRUE the results are stored in the working directory |
verbose |
boolean. If TRUE messages are promted in the console |
A list containing the results of the BioIndex workflow, including data frames and plot objects.
Walter Zupa [email protected]
BioIndex(ta=TA[TA$YEAR %in% c(2015, 2016), ], tb=TB[TB$YEAR %in% c(2015, 2016), ], tc=TC[TC$YEAR %in% c(2015, 2016), ], sspp="MERLMER",rec_threshold=200, spaw_threshold=210,sexes="all", depth=c(10,800), GSA=10, country="all", map_lim=c(13.3,15.2,39.9,41.3),depth_lines=c(50,200,800), strata=BioIndex::strata_scheme, stratification_tab = BioIndex::stratification, resolution=NA, buffer=0.1, wd=tempdir(), zip=FALSE, save=TRUE, verbose=TRUE)BioIndex(ta=TA[TA$YEAR %in% c(2015, 2016), ], tb=TB[TB$YEAR %in% c(2015, 2016), ], tc=TC[TC$YEAR %in% c(2015, 2016), ], sspp="MERLMER",rec_threshold=200, spaw_threshold=210,sexes="all", depth=c(10,800), GSA=10, country="all", map_lim=c(13.3,15.2,39.9,41.3),depth_lines=c(50,200,800), strata=BioIndex::strata_scheme, stratification_tab = BioIndex::stratification, resolution=NA, buffer=0.1, wd=tempdir(), zip=FALSE, save=TRUE, verbose=TRUE)
The function generates bubble plot of abundance and biomass indices by haul. If no resolution is specified (res = NA), the function works offline and uses an internal bathymetry dataset (med_bathy) covering the Mediterranean and Black Sea, reducing the computational time.
bubble_plot_by_haul_indexes( mTATB, map_lim, depth_lines, buffer = 0, res = NA, wd = NA, save = TRUE, verbose = TRUE )bubble_plot_by_haul_indexes( mTATB, map_lim, depth_lines, buffer = 0, res = NA, wd = NA, save = TRUE, verbose = TRUE )
mTATB |
data frame |
map_lim |
coordinates limits for the plotted map |
depth_lines |
vector of three depth bathymetrical lines to be plotted |
buffer |
buffer to the coordinate limits in map units |
res |
resolution of the bathymetrical lines |
wd |
working directory |
save |
boolean. If TRUE the plot is saved in the user defined working directory (wd) |
verbose |
boolean. If TRUE a message is printed |
A ggplot object representing the bubble plot of abundance or biomass by hauls.
Walter Zupa [email protected]
# Use internal data data(TA) data(TB) # Create a merged dataset for GSA 10 and year 2016 mTATB <- merge_TATB(TA[TA$AREA == 10 & TA$YEAR == 2016, ], TB[TB$AREA == 10 & TB$YEAR == 2016, ], "MERLMER") bubble_plot_by_haul_indexes(mTATB, map_lim = NA, depth_lines = c(200, 500, 800), save = FALSE)# Use internal data data(TA) data(TB) # Create a merged dataset for GSA 10 and year 2016 mTATB <- merge_TATB(TA[TA$AREA == 10 & TA$YEAR == 2016, ], TB[TB$AREA == 10 & TB$YEAR == 2016, ], "MERLMER") bubble_plot_by_haul_indexes(mTATB, map_lim = NA, depth_lines = c(200, 500, 800), save = FALSE)
The function generates bubbleplots of abundance indices for recruits and spawners If no resolution is specified (res = NA), the function works offline and uses an internal bathymetry dataset (med_bathy) covering the Mediterranean and Black Sea, reducing the computational time.
bubbleplot_RS_by_hauls( mTATC, map_range, thresh_rec, thresh_spaw, depths = c(50, 200, 800), res = NA, buffer = 0.1, wd = NA, save = TRUE, verbose = FALSE )bubbleplot_RS_by_hauls( mTATC, map_range, thresh_rec, thresh_spaw, depths = c(50, 200, 800), res = NA, buffer = 0.1, wd = NA, save = TRUE, verbose = FALSE )
mTATC |
mTATC table |
map_range |
range of coordinates for the map |
thresh_rec |
threshold value to select recruits data from mTATC table (reported in mm) |
thresh_spaw |
threshold value to select spawners data from mTATC table (reported in mm) |
depths |
three reference bathymetric lines to be plotted in the maps |
res |
resolution of the depth lines |
buffer |
buffer around the map |
wd |
working directory |
save |
boolean. If TRUE the outputs are saved in the local folder |
verbose |
boolean. If TRUE messages are prompted in the console |
A list containing two ggplot objects: the bubble plot of recruits (pr) and spawners (ps) abundance indices.
Walter Zupa [email protected]
# Create a merged dataset for GSA 10 mTATC <- merge_TATC(TA[TA$AREA==10,], TC[TC$AREA==10,], "MERLMER") bubbleplot_RS_by_hauls(mTATC, map_range=c(15,21,39,43), thresh_rec=200, thresh_spaw=250)# Create a merged dataset for GSA 10 mTATC <- merge_TATC(TA[TA$AREA==10,], TC[TC$AREA==10,], "MERLMER") bubbleplot_RS_by_hauls(mTATC, map_range=c(15,21,39,43), thresh_rec=200, thresh_spaw=250)
centroidi
centroidicentroidi
An object of class PackedSpatVector of length 1.
cgpmgrid
cgpmgridcgpmgrid
An object of class PackedSpatVector of length 1.
Check if in TB, TC or TE the date by haul is the same of the one reported in TA.
check_date_haul(DataTA, Data, year, wd = NA, suffix = NA)check_date_haul(DataTA, Data, year, wd = NA, suffix = NA)
DataTA |
MEDITS TA table |
Data |
MEDITS TB, TC or TE table |
year |
reference year for the analysis |
wd |
working directory |
suffix |
name of the log file |
TRUE if the validation passes, FALSE otherwise.
This function is an internal routine based on RoME version 0.2.3.
It is provided within BioIndex to ensure the package remains
functional and self-sufficient for data validation.
data(TA) data(TB) check_date_haul(TA, TB, year = 2007)data(TA) data(TB) check_date_haul(TA, TB, year = 2007)
The function checks whether the values contained in specific fields are consistent with the allowed values of the dictionaries.
check_dictionary( ResultData, Field, Values, year, wd = NA, suffix = NA, verbose = FALSE )check_dictionary( ResultData, Field, Values, year, wd = NA, suffix = NA, verbose = FALSE )
ResultData |
data frame in MEDITS tables |
Field |
field of the table to be checked |
Values |
vector of the allowed values |
year |
reference year for the analysis |
wd |
working directory |
suffix |
name of the log file |
verbose |
boolean. If TRUE messages are prompted in the console |
TRUE if the validation passes, FALSE otherwise.
This function is an internal routine based on RoME version 0.2.3.
It is provided within BioIndex to ensure the package remains
functional and self-sufficient for data validation.
data(TA) check_dictionary(TA, Field = "COUNTRY", Values = c("ITA"), year = 2007)data(TA) check_dictionary(TA, Field = "COUNTRY", Values = c("ITA"), year = 2007)
Check if all the hauls in TB are in TA.
check_hauls_TBTA(DataTA, DataTB, year, wd = NA, suffix = NA)check_hauls_TBTA(DataTA, DataTB, year, wd = NA, suffix = NA)
DataTA |
MEDITS TA table |
DataTB |
MEDITS TB table |
year |
reference year for the analysis |
wd |
working directory |
suffix |
name of the log file |
TRUE if the validation passes, FALSE otherwise.
This function is an internal routine based on RoME version 0.2.3.
It is provided within BioIndex to ensure the package remains
functional and self-sufficient for data validation.
data(TA) data(TB) check_hauls_TBTA(TA, TB, year = 2007)data(TA) data(TB) check_hauls_TBTA(TA, TB, year = 2007)
The function checks whether the values contained in specific fields are consistent with the allowed ranges.
check_numeric_range( ResultData, Field, Values, year, wd = NA, suffix = NA, verbose = FALSE )check_numeric_range( ResultData, Field, Values, year, wd = NA, suffix = NA, verbose = FALSE )
ResultData |
data frame in MEDITS tables |
Field |
field of the table to be checked |
Values |
vector of the allowed values |
year |
reference year for the analysis |
wd |
working directory |
suffix |
name of the log file |
verbose |
boolean. If TRUE messages are prompted in the console |
TRUE if the validation passes, FALSE otherwise.
This function is an internal routine based on RoME version 0.2.3.
It is provided within BioIndex to ensure the package remains
functional and self-sufficient for data validation.
data(TA) check_numeric_range(TA, Field = "HAUL_DURATION", Values = c(10, 120), year = 2007)data(TA) check_numeric_range(TA, Field = "HAUL_DURATION", Values = c(10, 120), year = 2007)
continent
continentcontinent
An object of class PackedSpatVector of length 1.
The function returns the data frame of the TA table with the coordinates expressed as decimal degrees.
convert_coordinates(Data)convert_coordinates(Data)
Data |
data frame of TA table |
the function return the same data frame with the coordinates converted in the decimal degrees format
data(TA) convert_coordinates(TA)data(TA) convert_coordinates(TA)
Function to estimate the hauls length using TA (table A, hauls data) with coordinates in the decimal degrees format (dd.ddd). The distances could be returned expressed in meters, kilometers and nautical miles.
dd.distance(data, unit = "m", verbose = TRUE)dd.distance(data, unit = "m", verbose = TRUE)
data |
data frame of the hauls data (TA, table A) with coordinates reported as decimal degrees |
unit |
string value indicating the measure unit of the distance. Allowed values: "m" for meters, "km" for kilometers and "NM" for nautical miles. |
verbose |
give verbose output reporting in the output the selected measure unit of the distance. |
The function returns the vector of the distances expressed in the selected measure unit.
data(TA) ta_dd <- MEDITS.to.dd(TA) dd.distance(ta_dd, unit = "km", verbose = FALSE)data(TA) ta_dd <- MEDITS.to.dd(TA) dd.distance(ta_dd, unit = "km", verbose = FALSE)
Conversion of decimal degrees coordinates in MEDITS format
dd.to.MEDITS(data)dd.to.MEDITS(data)
data |
data frame of the hauls data (TA, table A) in MEDITS format |
The function returns the data frame of the TA (table A) reporting the coordinates in MEDITS format.
data(TA) ta_dd <- MEDITS.to.dd(TA) dd.to.MEDITS(ta_dd)data(TA) ta_dd <- MEDITS.to.dd(TA) dd.to.MEDITS(ta_dd)
This function generates a spatial plot of haul positions over time, displaying haul labels and bathymetric lines over a customizable map extent. If no resolution is specified (res = NA), the function works offline and uses an internal bathymetry dataset (med_bathy) covering the Mediterranean and Black Sea, reducing the computational time.
hauls_position( mTATB, country = "all", map_lim, depth_lines, buffer = 0, res = NA, wd = NA, save = TRUE, verbose = TRUE )hauls_position( mTATB, country = "all", map_lim, depth_lines, buffer = 0, res = NA, wd = NA, save = TRUE, verbose = TRUE )
mTATB |
data frame |
country |
country code as reported in MEDITS format. "all" code to perform the analysis on all the countries of the same GSA |
map_lim |
coordinates limits for the plotted map |
depth_lines |
vactor of three depth bathymetrical lines to be plotted |
buffer |
buffer to the coordinate limits in map units |
res |
resolution of the bathymetrical lines |
wd |
working directory |
save |
boolean. If TRUE the plot is saved in the user defined working directory (wd) |
verbose |
boolean. If TRUE messages are reported in the console |
A ggplot object representing the spatial distribution of hauls.
Walter Zupa [email protected]
# Use internal data data(TA) data(TB) # Create a merged dataset for GSA 10 and year 2016 mTATB <- merge_TATB(TA[TA$AREA == 10 & TA$YEAR == 2016, ], TB[TB$AREA == 10 & TB$YEAR == 2016, ], "MERLMER") hauls_position(mTATB, country = "all", map_lim = NA, depth_lines = c(200, 500, 800), save = FALSE)# Use internal data data(TA) data(TB) # Create a merged dataset for GSA 10 and year 2016 mTATB <- merge_TATB(TA[TA$AREA == 10 & TA$YEAR == 2016, ], TB[TB$AREA == 10 & TB$YEAR == 2016, ], "MERLMER") hauls_position(mTATB, country = "all", map_lim = NA, depth_lines = c(200, 500, 800), save = FALSE)
Generates density and biomass maps based on the spatial grid, allowing for the visual identification of resource concentration areas or potential biological hotspots.
index_on_grid( mTATBsp, stratum, wd = NA, map_range, threshold = 30, verbose = FALSE, save = TRUE )index_on_grid( mTATBsp, stratum, wd = NA, map_range, threshold = 30, verbose = FALSE, save = TRUE )
mTATBsp |
spatial mTATB |
stratum |
reference stratum range (allowed values: "10,200","10,800","200,800","5,35","5,45") |
wd |
working directory |
map_range |
range of coordinates for the map |
threshold |
minimum number of individuals per haul |
verbose |
boolean. If TRUE messages are promted in the console |
save |
boolean. If TRUE the results are stored in the working directory |
A ggplot object displaying the generated map of indices on the spatial grid.
data(TA) data(TB) data(TC) m <- merge_TATBTC(TA[TA$AREA == 10, ], TB[TB$AREA == 10, ], TC[TC$AREA == 10, ], species = "MERLMER", country = "all", verbose = FALSE) mTATBsp <- overlayGrid(m[[1]], m[[2]], GSA = 10, save = FALSE, verbose = FALSE)[[1]] map_range <- c(9, 15, 39, 42) index_on_grid(mTATBsp, stratum = "10,800", map_range = map_range, threshold = 5, save = FALSE, verbose = FALSE)data(TA) data(TB) data(TC) m <- merge_TATBTC(TA[TA$AREA == 10, ], TB[TB$AREA == 10, ], TC[TC$AREA == 10, ], species = "MERLMER", country = "all", verbose = FALSE) mTATBsp <- overlayGrid(m[[1]], m[[2]], GSA = 10, save = FALSE, verbose = FALSE)[[1]] map_range <- c(9, 15, 39, 42) index_on_grid(mTATBsp, stratum = "10,800", map_range = map_range, threshold = 5, save = FALSE, verbose = FALSE)
Estimates specific abundance indices for the recruitment phase (using the user-defined cutoff value), allowing for the assessment of reproductive success and the prediction of future stock productivity.
index_recr( mTATB, mTATC, GSA, country, depth_range, cutoff, stratification, wd = NA, save = TRUE )index_recr( mTATB, mTATC, GSA, country, depth_range, cutoff, stratification, wd = NA, save = TRUE )
mTATB |
data frame |
mTATC |
data frame |
GSA |
reference GSA for the analysis |
country |
vector of reference countries for the analysis |
depth_range |
range of depth strata to perform the analysis (min, max) |
cutoff |
cutoff value for splitting recruits portion of population (reported in mm) |
stratification |
data frame of strata surface area |
wd |
working directory |
save |
boolean. If TRUE the plot is saved in the user defined working directory (wd) |
A data.frame containing the abundance indices and density for the recruitment fraction.
data(TA) data(TB) data(TC) data(stratification) m <- merge_TATBTC(TA[TA$AREA == 10, ], TB[TB$AREA == 10, ], TC[TC$AREA == 10, ], species = "MERLMER", country = "all", verbose = FALSE) index_recr(m[[1]], m[[2]], GSA = 10, country = "all", depth_range = c(10, 800), cutoff = 200, stratification = stratification, save = FALSE)data(TA) data(TB) data(TC) data(stratification) m <- merge_TATBTC(TA[TA$AREA == 10, ], TB[TB$AREA == 10, ], TC[TC$AREA == 10, ], species = "MERLMER", country = "all", verbose = FALSE) index_recr(m[[1]], m[[2]], GSA = 10, country = "all", depth_range = c(10, 800), cutoff = 200, stratification = stratification, save = FALSE)
Calculates abundance and biomass indices focused on the adult fraction (spawners, using the user-defined cutoff value), an essential indicator for evaluating the self-renewal capacity of the population.
index_spawn( mTATB, mTATC, GSA, country, depth_range, cutoff, stratification, wd = NA, save = TRUE )index_spawn( mTATB, mTATC, GSA, country, depth_range, cutoff, stratification, wd = NA, save = TRUE )
mTATB |
data frame |
mTATC |
data frame |
GSA |
reference GSA for the analysis |
country |
vector of reference countries for the analysis |
depth_range |
range of depth strata to perform the analysis (min, max) |
cutoff |
cutoff value for splitting spawner portion of population (reported in mm) |
stratification |
data frame of strata surface area |
wd |
working directory |
save |
boolean. If TRUE the plot is saved in the user defined working directory (wd) |
A data.frame containing the abundance and biomass indices for the spawner fraction.
data(TA) data(TB) data(TC) data(stratification) m <- merge_TATBTC(TA[TA$AREA == 10, ], TB[TB$AREA == 10, ], TC[TC$AREA == 10, ], species = "MERLMER", country = "all", verbose = FALSE) index_spawn(m[[1]], m[[2]], GSA = 10, country = "all", depth_range = c(10, 800), cutoff = 200, stratification = stratification, save = FALSE)data(TA) data(TB) data(TC) data(stratification) m <- merge_TATBTC(TA[TA$AREA == 10, ], TB[TB$AREA == 10, ], TC[TC$AREA == 10, ], species = "MERLMER", country = "all", verbose = FALSE) index_spawn(m[[1]], m[[2]], GSA = 10, country = "all", depth_range = c(10, 800), cutoff = 200, stratification = stratification, save = FALSE)
Estimation of abundance indices for females
index_ts_F( mTATB, GSA, country_analysis, depth_range, strata_scheme, stratification, wd = NA, save = TRUE )index_ts_F( mTATB, GSA, country_analysis, depth_range, strata_scheme, stratification, wd = NA, save = TRUE )
mTATB |
data frame |
GSA |
reference GSA for the analysis |
country_analysis |
vector of reference countries for the analysis |
depth_range |
range of depth strata to perform the analysis (min, max) |
strata_scheme |
data frame of the stratification scheme |
stratification |
data frame of strata surface area |
wd |
working directory |
save |
boolean. If TRUE the plot is saved in the user defined working directory (wd) |
A data.frame containing the time series of indices specifically for females.
data(TA) data(TB) data(TC) data(strata_scheme) data(stratification) m <- merge_TATBTC(TA[TA$AREA == 10, ], TB[TB$AREA == 10, ], TC[TC$AREA == 10, ], species = "MERLMER", country = "all", verbose = FALSE) strata_scheme_g10 <- strata_scheme[strata_scheme$GSA == 10 & strata_scheme$COUNTRY == "ITA", ] index_ts_F(m[[1]], GSA = 10, country_analysis = "all", depth_range = c(10, 800), strata_scheme = strata_scheme_g10, stratification = stratification, save = FALSE)data(TA) data(TB) data(TC) data(strata_scheme) data(stratification) m <- merge_TATBTC(TA[TA$AREA == 10, ], TB[TB$AREA == 10, ], TC[TC$AREA == 10, ], species = "MERLMER", country = "all", verbose = FALSE) strata_scheme_g10 <- strata_scheme[strata_scheme$GSA == 10 & strata_scheme$COUNTRY == "ITA", ] index_ts_F(m[[1]], GSA = 10, country_analysis = "all", depth_range = c(10, 800), strata_scheme = strata_scheme_g10, stratification = stratification, save = FALSE)
Estimation of abundance indices for males
index_ts_M( mTATB, GSA, country_analysis, depth_range, strata_scheme, stratification, wd = NA, save = TRUE )index_ts_M( mTATB, GSA, country_analysis, depth_range, strata_scheme, stratification, wd = NA, save = TRUE )
mTATB |
data frame |
GSA |
reference GSA for the analysis |
country_analysis |
vector of reference countries for the analysis |
depth_range |
range of depth strata to perform the analysis (min, max) |
strata_scheme |
data frame of the stratification scheme |
stratification |
data frame of strata surface area |
wd |
working directory |
save |
boolean. If TRUE the plot is saved in the user defined working directory (wd) |
A data.frame containing the time series of indices specifically for males.
data(TA) data(TB) data(TC) data(strata_scheme) data(stratification) m <- merge_TATBTC(TA[TA$AREA == 10, ], TB[TB$AREA == 10, ], TC[TC$AREA == 10, ], species = "MERLMER", country = "all", verbose = FALSE) strata_scheme_g10 <- strata_scheme[strata_scheme$GSA == 10 & strata_scheme$COUNTRY == "ITA", ] index_ts_M(m[[1]], GSA = 10, country_analysis = "all", depth_range = c(10, 800), strata_scheme = strata_scheme_g10, stratification = stratification, save = FALSE)data(TA) data(TB) data(TC) data(strata_scheme) data(stratification) m <- merge_TATBTC(TA[TA$AREA == 10, ], TB[TB$AREA == 10, ], TC[TC$AREA == 10, ], species = "MERLMER", country = "all", verbose = FALSE) strata_scheme_g10 <- strata_scheme[strata_scheme$GSA == 10 & strata_scheme$COUNTRY == "ITA", ] index_ts_M(m[[1]], GSA = 10, country_analysis = "all", depth_range = c(10, 800), strata_scheme = strata_scheme_g10, stratification = stratification, save = FALSE)
Computes time series of stratified abundance and biomass indices, serving as the primary tool for monitoring temporal trends in stock status.
indices_ts( mTATB, GSA, country = "all", depth_range, strata_scheme, stratification, wd = NA, save = TRUE )indices_ts( mTATB, GSA, country = "all", depth_range, strata_scheme, stratification, wd = NA, save = TRUE )
mTATB |
data frame |
GSA |
reference GSA for the analysis |
country |
reference countries in the GSA for the analysis |
depth_range |
range of depth strata to perform the analysis (min, max) |
strata_scheme |
data frame of the stratification scheme |
stratification |
data frame of strata surface area |
wd |
working directory |
save |
boolean. If TRUE the plot is saved in the user defined working directory (wd) |
A list of ggplot objects representing the time series of calculated indices.
Walter Zupa [email protected]
data(TA) data(TB) # Create a merged dataset for GSA 10 mTATB <- merge_TATB(TA[TA$AREA==10,], TB[TB$AREA==10,], "MERLMER") # Run indices_ts indices_ts(mTATB, GSA=10, country="all", depth_range=c(10,800), strata_scheme=BioIndex::strata_scheme, stratification=BioIndex::stratification, wd=tempdir(), save=FALSE)data(TA) data(TB) # Create a merged dataset for GSA 10 mTATB <- merge_TATB(TA[TA$AREA==10,], TB[TB$AREA==10,], "MERLMER") # Run indices_ts indices_ts(mTATB, GSA=10, country="all", depth_range=c(10,800), strata_scheme=BioIndex::strata_scheme, stratification=BioIndex::stratification, wd=tempdir(), save=FALSE)
Interception Union Tets
IUT(abundance, biomass, species, lastn = 5, GSA = 10, wd = NA, save = TRUE)IUT(abundance, biomass, species, lastn = 5, GSA = 10, wd = NA, save = TRUE)
abundance |
dataframe of abundance time series as produced by indices_ts function |
biomass |
dataframe of biomass time series as produced by indices_ts function |
species |
reference species for the analysis (MEDITS code) |
lastn |
number of recent years for diagnosis of change |
GSA |
reference GSA for the analysis (default is 10) |
wd |
working directory (default is NA, uses tempdir()) |
save |
boolean. If TRUE results are saved in the output folder |
A data.frame containing the Indicator of Unfished Trends (IUT) results.
Input parameters include biological and haul data, stratification schemes, reference filters (e.g., sex, GSA, country, depth), and output control options (working directory, saving, verbosity).
LFD( mTATC, sex = "all", GSA, country = "all", depth_range, strata_scheme, stratification, wd = NA, save = TRUE, verbose = TRUE )LFD( mTATC, sex = "all", GSA, country = "all", depth_range, strata_scheme, stratification, wd = NA, save = TRUE, verbose = TRUE )
mTATC |
Data frame resulting from the merge of TA and TC datasets using 'merge_TATBTC()'. It must include raised numbers. |
sex |
Character. Target sex for the analysis. Allowed values: '"F"', '"M"', '"I"', '"N"', or '"all"' (default) for combined sexes. |
GSA |
Numeric. The GSA (Geographical Sub-Area) code of reference for the analysis. |
country |
Character vector. Reference country or countries for the analysis. Use '"all"' (default) to include all countries available in the data. |
depth_range |
Numeric vector of length 2, specifying the minimum and maximum depths (in meters) to filter the hauls used in the analysis. |
strata_scheme |
Data frame containing the stratification scheme. Must include 'CODE', 'MIN_DEPTH', 'MAX_DEPTH', 'GSA', 'COUNTRY'. |
stratification |
Data frame with surface areas per stratum. Must include columns: 'GSA', 'CODE', 'COUNTRY', 'SURF'. |
wd |
Character. Working directory used to save output plots and tables. Required if 'save = TRUE'. |
save |
Logical. If 'TRUE' (default), the function saves output tables and plots to 'wd/output/'. If 'FALSE', no files are saved. |
verbose |
Logical. If 'TRUE' (default), informative messages are printed to the console to trace the function steps. |
This function estimates and plots the length frequency distribution (LFD) by year and by stratum, based on merged biological and haul data from MEDITS surveys. It computes raised numbers, applies stratification weights, and generates publication-ready plots and CSV outputs. Stratification weighting is based on swept area and surface area of the strata.
The function:
Filters hauls by depth and country.
Computes raised numbers per haul.
Applies stratified weights based on the area per stratum.
Outputs and/or plots the length frequency distribution by year and stratum.
Handles sex-specific or combined-sex analyses.
The plot outputs include:
Combined LFD by year across all strata.
LFD by stratum (faceted), stratified by year.
Output files are saved as CSV and high-resolution JPEGs if 'save = TRUE' and 'wd' is defined.
A named list with two elements:
A data frame of total LFD by year across all strata.
A data frame of LFD by year and by stratum.
A list of ggplot objects representing the length-frequency distributions.
data(TA) data(TC) # Create a merged dataset for GSA 10 mTATC <- merge_TATC(TA[TA$AREA==10,], TC[TC$AREA==10,], "MERLMER") LFD(mTATC, sex="all", GSA=10, country="all", depth_range=c(10,800), strata_scheme=BioIndex::strata_scheme, stratification=BioIndex::stratification, wd=tempdir(), save=FALSE)data(TA) data(TC) # Create a merged dataset for GSA 10 mTATC <- merge_TATC(TA[TA$AREA==10,], TC[TC$AREA==10,], "MERLMER") LFD(mTATC, sex="all", GSA=10, country="all", depth_range=c(10,800), strata_scheme=BioIndex::strata_scheme, stratification=BioIndex::stratification, wd=tempdir(), save=FALSE)
Estimation of L50 and L95
Lquant(lfd, wd = NA, sspp, GSA, save = TRUE, verbose = TRUE)Lquant(lfd, wd = NA, sspp, GSA, save = TRUE, verbose = TRUE)
lfd |
data frame of combined LFD |
wd |
working directory |
sspp |
MEDITS code for the selected species |
GSA |
reference area for the analysis |
save |
boolean. If TRUE the plot is saved in the user defined working directory (wd) |
verbose |
boolean. If TRUE messages are reported in the console |
A data.frame containing the length quantiles (e.g., L95) time series.
Estimates the length-weight relationship for the selected species, a fundamental biological indicator to assess fish condition and convert numerical length estimates into biomass equivalents.
LW( ta, te, sp, GSA, country = "all", nyears = NA, wd = NA, save = TRUE, verbose = FALSE )LW( ta, te, sp, GSA, country = "all", nyears = NA, wd = NA, save = TRUE, verbose = FALSE )
ta |
MEDITS or MEDITS-like TA table |
te |
MEDITS or MEDITS-like TE table |
sp |
species RUBIN code (MEDITS format, e.g. "MERLMER") |
GSA |
reference GSA for the analysis |
country |
reference country |
nyears |
number of years of the time series to be considered in the analysis |
wd |
path of the working directory |
save |
boolean. If TRUE the outputs are saved in the local folder |
verbose |
boolean. If TRUE messages are promted in the console |
A data.frame containing the length-weight relationship parameters and statistics.
Estimation of LW relationship
LWf(TE, sp, GEAR, GSA, country = NA, n_records = 10, wd = NA, save = TRUE)LWf(TE, sp, GEAR, GSA, country = NA, n_records = 10, wd = NA, save = TRUE)
TE |
MEDITS or MEDITS-like TE table |
sp |
species RUBIN code (MEDITS format, e.g. "MERLMER") |
GEAR |
type of gear reported in the corresponding TA file |
GSA |
reference GSA for the analysis |
country |
reference country |
n_records |
minimum number of records to perform the analysis |
wd |
path of the working directory |
save |
boolean. If TRUE the outputs are saved in the local folder |
A data.frame containing the length-weight relationship parameters specifically for females.
Walter Zupa [email protected]
A precomputed bathy object containing bathymetric data for the Mediterranean Sea
and the Black Sea. Depth values are restricted between 0 and -1000 meters. This dataset
was downloaded using getNOAA.bathy with a resolution of 1 arc-minute,
and filtered to remove deeper areas.
data(med_bathy)data(med_bathy)
An object of class bathy (a matrix with longitude and latitude as axes, and depth in meters)
The object can be used directly with functions from the marmap package, such as
plot.bathy() and get.depth().
The spatial extent includes:
Longitude: from -6° to 42°
Latitude: from 30° to 47°
Depth: from 0 to -1000 meters
Only marine cells within this depth range are retained. Land and deeper areas are set to NA.
NOAA ETOPO1 via marmap::getNOAA.bathy()
getNOAA.bathy, plot.bathy, bubbleplot_RS_by_hauls
Estimation of haul distance
MEDITS.distance(data, unit = "m", verbose = TRUE)MEDITS.distance(data, unit = "m", verbose = TRUE)
data |
data frame containing the hauls data (TA, table A). |
unit |
string value indicating the measure unit of the distance. Allowed values: "m" for meters, "km" for kilometers and "NM" for nautical miles. |
verbose |
give verbose output reporting in the output the selected measure unit of the distance. |
The function returns the vector of the distances expressed in the selected measure unit.
data(TA) MEDITS.distance(TA, unit = "m", verbose = FALSE)data(TA) MEDITS.distance(TA, unit = "m", verbose = FALSE)
Conversion of MEDITS format coordinates in decimal degrees format
MEDITS.to.dd(data)MEDITS.to.dd(data)
data |
data frame of the hauls data (TA, table A) in MEDITS format |
The function returns the data frame of the TA table with the coordinates expressed as decimal degrees
data(TA) MEDITS.to.dd(TA)data(TA) MEDITS.to.dd(TA)
Combines haul-level operational data (TA) with species catch data (TB),
providing the essential foundation for calculating stratified abundance (N)
and biomass (kg) indices.
The function keeps only valid hauls, performs quality checks (times,
positions, wing opening, haul/date consistency) using internal validation
functions (based on RoME version 0.2.3), computes spatial means,
swept area, depth stratum, biomass/density indicators, and—optionally—writes
the merged data to disk.
merge_TATB( ta, tb, species, country = "all", strata = BioIndex::strata_scheme, wd = NA, save = FALSE, verbose = TRUE )merge_TATB( ta, tb, species, country = "all", strata = BioIndex::strata_scheme, wd = NA, save = FALSE, verbose = TRUE )
ta |
A 'data.frame'/'data.table' containing a full TA dataset (columns listed in 'BioIndex::TA_cols'). |
tb |
A 'data.frame'/'data.table' containing a full TB dataset (columns listed in 'BioIndex::TB_cols'). |
species |
Character, MEDITS 7-letter code (e.g. '"ARISFOL"'). The first 4 characters are interpreted as *GENUS* and the last 3 as *SPECIES*. |
country |
Character vector of ISO-3 country codes to keep; use '"all"' (default) to keep every country present in 'ta'. |
strata |
Depth-stratum reference table; default is 'BioIndex::strata_scheme'. |
wd |
Working directory. If 'NA' (the default when 'save = FALSE') no files are written. |
save |
Logical. If 'TRUE', writes '"mergeTATB_<GENUS><SPECIES>.csv"' to 'file.path(wd, "output")'. |
verbose |
Logical; if 'TRUE' (default) prints progress messages. |
The implementation mirrors the original BioIndex routine.
Data Validation:
The function performs syntactic data validation using internal
implementations of the validation routines (based on RoME v0.2.3).
Optimisations: Includes two speed-ups: (1) vectorised replacement of missing '"NA NA"' records, (2) a single loop over depth strata instead of a nested haul × stratum loop. Results are identical to the reference routine.
A 'data.frame' with one row per haul and the following groups of variables: * **TA** metadata (haul position, times, depths, etc.) * **TB** catch totals (numbers and weight) * Calculated fields: mean lat/lon, swept area, depth stratum, density ('N_h', 'N_km2') and biomass ('kg_h', 'kg_km2')
This version of BioIndex uses internal validation functions based on
RoME version 0.2.3. The package is fully self-sufficient and does
not require external validation packages to be installed.
[BioIndex] package documentation.
# Use internal data data("TA", package = "BioIndex") data("TB", package = "BioIndex") m_tb <- merge_TATB( ta = TA, tb = TB, species = "ARISFOL", country = "ITA", wd = tempdir(), save = FALSE ) head(m_tb)# Use internal data data("TA", package = "BioIndex") data("TB", package = "BioIndex") m_tb <- merge_TATB( ta = TA, tb = TB, species = "ARISFOL", country = "ITA", wd = tempdir(), save = FALSE ) head(m_tb)
This function is the primary entry point for integrating MEDITS survey data (e.g. TA, TB, and TC tables), producing unified datasets essential for population analysis and the estimation of demographic indicators. The routine:
filters hauls by validity and by country;
performs a full set of quality checks (times, positions, wing opening,
haul/date consistency) using internal validation functions
(based on RoME version 0.2.3);
merges TA with TB and TA with TC, respectively;
computes swept area, mean positions, depth stratum, raising factors, densities and biomasses;
(optionally) writes the two merged tables to
file.path(wd, "output").
merge_TATBTC( ta, tb, tc, species, country = "all", strata = BioIndex::strata_scheme, wd = NA, save = TRUE, verbose = TRUE )merge_TATBTC( ta, tb, tc, species, country = "all", strata = BioIndex::strata_scheme, wd = NA, save = TRUE, verbose = TRUE )
ta |
A MEDITS or MEDITS-like TA table
(columns listed in |
tb |
A MEDITS or MEDITS-like TB table
(columns listed in |
tc |
A MEDITS or MEDITS-like TC table
(columns listed in |
species |
Character. MEDITS 7-letter RUBIN code (e.g. |
country |
Character vector of MEDITS country codes to keep.
Use |
strata |
A data-frame with the depth-stratification scheme adopted
by the MEDITS survey. Defaults to
|
wd |
Working directory. When |
save |
Logical. If |
verbose |
Logical (default |
The implementation reproduces the official BioIndex workflow.
Data Validation:
The function automatically performs syntactic data validation using internal
routines based on RoME version 0.2.3 logic to ensure data integrity
and standardisation.
Optimisations: Two micro-optimisations are included:
vectorised replacement of missing "NA NA" entries
in both merges;
a single loop over depth strata (instead of haul × stratum) to
assign STRATUM_CODE.
Numerical outputs are identical to the reference routine.
A list of two data.frames:
merge_TA_TBOne row per haul with TA metadata, TB catch totals, depth stratum, densities and biomasses.
merge_TA_TCOne row per haul/length-class/sex/maturity with TA metadata, TC counts, depth stratum, raising factor, densities and biomasses.
A list containing two data frames: the first with merged TA-TB-TC data at the haul level, and the second with the length-frequency distribution.
This version of BioIndex uses internal validation functions based on
RoME version 0.2.3. The package is fully self-sufficient and does
not require external validation packages to be installed.
Walter Zupa [email protected]
# Use internal data data("TA", package = "BioIndex") data("TB", package = "BioIndex") data("TC", package = "BioIndex") m <- merge_TATBTC( ta = TA, tb = TB, tc = TC, species = "MERLMER", country = "all", wd = tempdir(), verbose = TRUE ) mTATB <- m[[1]] # TA–TB merged table mTATC <- m[[2]] # TA–TC merged table# Use internal data data("TA", package = "BioIndex") data("TB", package = "BioIndex") data("TC", package = "BioIndex") m <- merge_TATBTC( ta = TA, tb = TB, tc = TC, species = "MERLMER", country = "all", wd = tempdir(), verbose = TRUE ) mTATB <- m[[1]] # TA–TB merged table mTATC <- m[[2]] # TA–TC merged table
Links haul metadata (TA) with length-frequency samples (TC),
enabling the analysis of population demographic structure and the
reconstruction of length-frequency distributions (LFD).
The function keeps only valid hauls, runs all relevant quality checks
(times, positions, wing opening, haul/date consistency) using internal
validation functions (based on RoME version 0.2.3),
computes swept area, depth stratum, raising factors,
abundance/biomass indicators, and—optionally—writes the merged data.
merge_TATC( ta, tc, species, country = "all", strata = BioIndex::strata_scheme, wd = NA, save = TRUE, verbose = TRUE )merge_TATC( ta, tc, species, country = "all", strata = BioIndex::strata_scheme, wd = NA, save = TRUE, verbose = TRUE )
ta |
A 'data.frame'/'data.table' containing a full TA dataset (columns listed in 'BioIndex::TA_cols'). |
tc |
A 'data.frame'/'data.table' containing a full TC dataset (columns listed in 'BioIndex::TC_cols'). |
species |
Character, MEDITS 7-letter code (e.g. '"ARISFOL"'). The first 4 characters are interpreted as *GENUS* and the last 3 as *SPECIES*. |
country |
Character vector of ISO-3 country codes to keep; use '"all"' (default) to keep every country present in 'ta'. |
strata |
Depth-stratum reference table; default is 'BioIndex::strata_scheme'. |
wd |
Working directory. If 'NA' (the default when 'save=FALSE') no files are written. |
save |
Logical. If 'TRUE', writes '"mergeTATC_<GENUS><SPECIES>.csv"' to 'file.path(wd, "output")'. |
verbose |
Logical; if 'TRUE' (default) prints progress messages. |
The code is identical to the official BioIndex routine.
Data Validation:
The function performs syntactic data validation using internal
implementations of the validation routines (based on RoME v0.2.3).
Optimisations: Includes two micro-optimisations: vectorised handling of missing '"NA NA"' entries and a single depth-stratum loop. Numerical results remain unchanged.
A 'data.frame' in which each row represents one length-class (and sex/maturity) sampled in a haul, including: * **TA** metadata * **TC** length-frequency counts and weights * Calculated fields: mean lat/lon, swept area, depth stratum, raising factor, density ('N_h', 'N_km2') and biomass ('kg_h', 'kg_km2')
This version of BioIndex uses internal validation functions based on
RoME version 0.2.3. The package is fully self-sufficient and does
not require external validation packages to be installed.
[BioIndex] package documentation.
# Use internal data data("TA", package = "BioIndex") data("TC", package = "BioIndex") m_tc <- merge_TATC( ta = TA, tc = TC, species = "ARISFOL", country = "ESP", wd = tempdir(), save=FALSE ) head(m_tc)# Use internal data data("TA", package = "BioIndex") data("TC", package = "BioIndex") m_tc <- merge_TATC( ta = TA, tc = TC, species = "ARISFOL", country = "ESP", wd = tempdir(), save=FALSE ) head(m_tc)
Calculates the Mean Individual Weight (MIW) time series, providing a summary indicator of the average size within the captured population and potential shifts due to fishing pressure.
MIW( mTATB, GSA, country = "all", depth_range, strata_scheme, stratification, wd = NA, save = TRUE, verbose = TRUE )MIW( mTATB, GSA, country = "all", depth_range, strata_scheme, stratification, wd = NA, save = TRUE, verbose = TRUE )
mTATB |
data frame of the merged TA and TB |
GSA |
reference GSA for the analysis |
country |
reference countries in the GSA for the analysis |
depth_range |
range of depth strata to perform the analysis (min, max) |
strata_scheme |
data frame of the stratification scheme |
stratification |
data frame of strata surface area |
wd |
working directory |
save |
boolean. If TRUE the plot is saved in the user defined working directory (wd) |
verbose |
boolean. If TRUE messages are reported in the console |
A data.frame containing the Mean Individual Weight (MIW) time series.
data(TA) data(TB) # Create a merged dataset for GSA 10 mTATB <- merge_TATB(TA[TA$AREA==10,], TB[TB$AREA==10,], "MERLMER") MIW(mTATB, GSA=10, country="all", depth_range=c(10,800), strata_scheme=BioIndex::strata_scheme, stratification=BioIndex::stratification, wd=tempdir(), save=FALSE)data(TA) data(TB) # Create a merged dataset for GSA 10 mTATB <- merge_TATB(TA[TA$AREA==10,], TB[TB$AREA==10,], "MERLMER") MIW(mTATB, GSA=10, country="all", depth_range=c(10,800), strata_scheme=BioIndex::strata_scheme, stratification=BioIndex::stratification, wd=tempdir(), save=FALSE)
Overlays survey haul data onto a standard spatial grid (e.g., GFCM grid), harmonizing biological information with a consistent geographic structure for standardized spatial analysis.
overlayGrid( mTATB, mTATC, GSA = NA, country = "all", wd = NA, save = TRUE, verbose = FALSE )overlayGrid( mTATB, mTATC, GSA = NA, country = "all", wd = NA, save = TRUE, verbose = FALSE )
mTATB |
data frame of the merged TA and TB |
mTATC |
data frame of the merged TA and TC |
GSA |
reference GSA for the analysis |
country |
reference countries for the analysis |
wd |
working directory used to save results |
save |
boolean. If TRUE the outputs are saved in the local folder |
verbose |
boolean. If TRUE messages are prompted in the console |
A list or data.frame containing the merged biological data mapped to the spatial grid.
# Use internal data data(TA) data(TB) data(TC) # Create a merged dataset for GSA 10 m <- merge_TATBTC(TA[TA$AREA==10,], TB[TB$AREA==10,], TC[TC$AREA==10,], species="MERLMER") mTATB <- m[[1]] mTATC <- m[[2]] overlayGrid(mTATB, mTATC, GSA=10, save=FALSE)# Use internal data data(TA) data(TB) data(TC) # Create a merged dataset for GSA 10 m <- merge_TATBTC(TA[TA$AREA==10,], TB[TB$AREA==10,], TC[TC$AREA==10,], species="MERLMER") mTATB <- m[[1]] mTATC <- m[[2]] overlayGrid(mTATB, mTATC, GSA=10, save=FALSE)
Quantile estimation
quant(weighted, qlin = 0.95)quant(weighted, qlin = 0.95)
weighted |
LFD data.frame |
qlin |
reference quantile for the analysis |
A numeric value or vector containing the requested quantiles.
launches the embedded Shiny application included in the package.
run_BioIndex_app()run_BioIndex_app()
No return value, called for side effects (launches the Shiny application).
Walter Zupa [email protected]
if (interactive()) { run_BioIndex_app() }if (interactive()) { run_BioIndex_app() }
Assesses the proportion of sexes within the population, providing critical information on demographic structure, reproductive potential, and stock resilience.
sex_ratio( mTATB, GSA, country, depth_range, stratas, stratification, wd = NA, save = TRUE, verbose = FALSE )sex_ratio( mTATB, GSA, country, depth_range, stratas, stratification, wd = NA, save = TRUE, verbose = FALSE )
mTATB |
data frame of the merged TA and TB |
GSA |
reference GSA for the analysis |
country |
vector of reference countries for the analysis |
depth_range |
range of depth strata to perform the analysis (min, max) |
stratas |
data frame of the reference strata for the study area |
stratification |
data frame of strata surface area |
wd |
working directory |
save |
boolean. If TRUE the plot is saved in the user defined working directory (wd) |
verbose |
boolean. If TRUE a message is printed |
A data.frame containing the sex ratio statistics by year and stratum.
Walter Zupa [email protected]
data(TA) data(TB) # Create a merged dataset for GSA 10 mTATB <- merge_TATB(TA[TA$AREA==10,], TB[TB$AREA==10,], "MERLMER") sex_ratio(mTATB, GSA=10, country="all", depth_range=c(10,800), stratas=BioIndex::strata_scheme, stratification=BioIndex::stratification, wd=tempdir(), save=FALSE)data(TA) data(TB) # Create a merged dataset for GSA 10 mTATB <- merge_TATB(TA[TA$AREA==10,], TB[TB$AREA==10,], "MERLMER") sex_ratio(mTATB, GSA=10, country="all", depth_range=c(10,800), stratas=BioIndex::strata_scheme, stratification=BioIndex::stratification, wd=tempdir(), save=FALSE)
This function calculates and plots the spatial distribution of sex ratio (F / (F + M)) over the GFCM grid for a given species. It uses data from merged MEDITS datasets (TA, TB, TC), previously spatialized with 'overlayGrid()'. The function filters hauls by total abundance threshold and depth range, calculates sex ratio per grid cell, and plots the output using color-coded categories based on quantiles. The result is a choropleth map of sex ratio patterns, useful to highlight spatial differences in sex structure. Raw sex ratio estimates per grid cell can also be exported.
sex_ratio_on_grid( mTATBsp, depth, wd = NA, map_range, threshold = 30, verbose = FALSE, save = TRUE )sex_ratio_on_grid( mTATBsp, depth, wd = NA, map_range, threshold = 30, verbose = FALSE, save = TRUE )
mTATBsp |
A spatial version of the merged TA-TB dataset, processed through 'overlayGrid()', containing sex information. |
depth |
Character string specifying the depth range used for filtering (e.g., '"10,800"'). Must correspond to available internal GFCM grid masks. |
wd |
Working directory. Used to save output files if 'save = TRUE'. |
map_range |
numeric vector with coordinates defining the map extent ('xmin', 'xmax', 'ymin', 'ymax'). |
threshold |
Minimum number of individuals required per haul to be included in the sex ratio estimation. Default is 30. |
verbose |
Logical. If 'TRUE', informative messages are printed to the console. |
save |
Logical. If 'TRUE', the plot and sex ratio table are saved to the working directory. |
A 'data.frame' containing sex ratio ('ratio'), standard deviation ('sd'), and coefficient of variation ('CV') for each GFCM grid cell.
data(TA) data(TB) data(TC) m <- merge_TATBTC(TA[TA$AREA == 10, ], TB[TB$AREA == 10, ], TC[TC$AREA == 10, ], species = "MERLMER", country = "all", verbose = FALSE) mTATBsp <- overlayGrid(m[[1]], m[[2]], GSA = 10, save = FALSE, verbose = FALSE)[[1]] map_range <- c(9, 15, 39, 42) sex_ratio_on_grid(mTATBsp, depth = "10,800", map_range = map_range, threshold = 5, save = FALSE, verbose = FALSE)data(TA) data(TB) data(TC) m <- merge_TATBTC(TA[TA$AREA == 10, ], TB[TB$AREA == 10, ], TC[TC$AREA == 10, ], species = "MERLMER", country = "all", verbose = FALSE) mTATBsp <- overlayGrid(m[[1]], m[[2]], GSA = 10, save = FALSE, verbose = FALSE)[[1]] map_range <- c(9, 15, 39, 42) sex_ratio_on_grid(mTATBsp, depth = "10,800", map_range = map_range, threshold = 5, save = FALSE, verbose = FALSE)
Spearman test for timeseries
spear(x)spear(x)
x |
time series |
A data.frame representing the Spearman correlation coefficient and related statistics.
x <- runif(10, 1, 100) spear(x)x <- runif(10, 1, 100) spear(x)
Spearman test
spearman( abundance = NA, biomass = NA, years, sspp = NA, wd = NA, save = TRUE, verbose = FALSE )spearman( abundance = NA, biomass = NA, years, sspp = NA, wd = NA, save = TRUE, verbose = FALSE )
abundance |
data frame of abundance indices |
biomass |
data frame of biomass indices |
years |
reference years for the analysis |
sspp |
reference species for the analysis |
wd |
path of working directory |
save |
boolean. If TRUE the plot is saved in the user defined working directory (wd) |
verbose |
boolean. If TRUE messages are prompted in the console |
A data.frame or list with the results of the Spearman rank correlation test.
abundance <- data.frame(year = 2010:2020, index = runif(11, 1, 10)) biomass <- data.frame(year = 2010:2020, index = runif(11, 5, 20)) spearman(abundance=abundance, biomass=biomass, years=c(2010,2020), sspp="MERLMER", wd=tempdir(), save=FALSE)abundance <- data.frame(year = 2010:2020, index = runif(11, 1, 10)) biomass <- data.frame(year = 2010:2020, index = runif(11, 5, 20)) spearman(abundance=abundance, biomass=biomass, years=c(2010,2020), sspp="MERLMER", wd=tempdir(), save=FALSE)
Stratification scheme adopted in the bottom trawl demersal survey (e.g. MEDITS survey).
strata_schemestrata_scheme
An object of class data.frame with 126 rows and 5 columns.
Walter Zupa [email protected]
Stratification scheme adopted in the rapa whelk survey (e.g. Black Sea beam trawl survey).
strata_scheme_rapanastrata_scheme_rapana
An object of class data.frame with 7 rows and 5 columns.
Walter Zupa [email protected]
Data frame containing the surface area relative to the depth strata adopted in the stratification scheme (strata_scheme) of the demersal surveys (e.g. MEDITS survey).
stratificationstratification
An object of class data.frame with 276 rows and 6 columns.
Data frame containing the surface area relative to the depth strata adopted in the stratification scheme (strata_scheme) of the rapa whelk surveys (e.g. Black Sea beam trawl survey).
stratification_rapanastratification_rapana
An object of class data.frame with 7 rows and 6 columns.
stratum_0_125
stratum_0_125stratum_0_125
An object of class PackedSpatVector of length 1.
stratum_0_200
stratum_0_200stratum_0_200
An object of class PackedSpatVector of length 1.
stratum_0_35
stratum_0_35stratum_0_35
An object of class PackedSpatVector of length 1.
stratum_0_45
stratum_0_45stratum_0_45
An object of class PackedSpatVector of length 1.
stratum_0_800
stratum_0_800stratum_0_800
An object of class PackedSpatVector of length 1.
stratum_200_800
stratum_200_800stratum_200_800
An object of class PackedSpatVector of length 1.
TA table example
TATA
An object of class data.frame with 100 rows and 43 columns.
TA table headings
TA_colsTA_cols
An object of class character of length 22.
Walter Zupa [email protected]
TB table example
TBTB
An object of class data.frame with 3059 rows and 19 columns.
TB table headings
TB_colsTB_cols
An object of class character of length 8.
Walter Zupa [email protected]
TC table example
TCTC
An object of class data.frame with 11185 rows and 22 columns.
TC table headings
TC_colsTC_cols
An object of class character of length 11.
Walter Zupa [email protected]