| Title: | Multiple Checks on MEDITS Trawl Survey Data |
|---|---|
| Description: | Provides quality checks for MEDITS (International Bottom Trawl Survey in the Mediterranean) trawl survey exchange data tables (TA (Haul data), TB (Catch data), TC (Biological data), TE (Biological individual data), TL (Litter data)). The main function RoME() calls all check functions in a defined sequence to perform a complete quality control of TX (Generic exchange data) data, including header validation, controlled-vocabulary checks, cross-table consistency tests, and biological plausibility checks. No automatic correction is applied: the package detects errors, warns the user, and specifies the type of error to ease data correction. Checks can be run simultaneously on multi-year datasets. An embedded 'shiny' application is also provided via run_RoME_app(). References describing the methods: MEDITS Working Group (2017). |
| Authors: | Walter Zupa [aut, cre], Isabella Bitetto [aut], Maria Teresa Spedicato [aut], Loredana Casciaro [rev], Cosmidano Neglia [rev] |
| Maintainer: | Walter Zupa <zupa@fondazionecoispa.org> |
| License: | GPL-3 |
| Version: | 0.2.4 |
| Built: | 2026-09-21 09:31:06 UTC |
| Source: | https://github.com/cran/RoME |
List of the allowed association between categories and subcategories in litter data table (TL)
data("assTL")data("assTL")
A data frame with 42 observations on the following 2 variables.
LITTER_CATEGORYList of litter categories
List of litter sub-categories
The table is used to check the correctness of the categories/sub-categories associations in litter data tables (TL).
W. Zupa
Anonymus (2017) "MEDITS-Handbook. Version n. 9. MEDITS Working Group"
Anonymus (2017) "MEDITS-Handbook. Version n. 9. MEDITS Working Group"
data(assTL) str(assTL)data(assTL) str(assTL)
The function checks the presence of 0 fields in the following haul data table (TA, according to MEDITS protocol) fields: WING_OPENING, WARP_DIAMETER and VERTICAL_OPENING
check_0_fieldsTA(DataTA,wd,suffix,year)check_0_fieldsTA(DataTA,wd,suffix,year)
DataTA |
Haul data table according to MEDITS protocol (TA) |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
year |
reference year for the analysis |
The function returns a boolean value. It is FALSE in case 0 values are detected in the TA table's fields
Isabella Bitetto [aut,cre] <bitetto@coispa.it>; Walter Zupa [aut, cre] <zupa@coispa.it>
Anonymus (2017) "MEDITS-Handbook. Version n. 9. MEDITS Working Group"
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" check_0_fieldsTA(RoME::TA,wd,suffix, year=2007)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" check_0_fieldsTA(RoME::TA,wd,suffix, year=2007)
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 , 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)check_abundance(ResultDataTA, ResultDataTB, year, wd, suffix = NULL, distance_unit = "km", min_hauls = 5L)
ResultDataTA |
Data frame containing at least the columns |
ResultDataTB |
Data frame containing at least |
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 |
min_hauls |
Minimum number of valid hauls a species must appear in to be
plotted. Defaults to |
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.
Logical scalar (TRUE if no errors, FALSE otherwise).
W. Zupa.
wd <- tempdir() check_abundance(ResultDataTA = RoME::TA, ResultDataTB = RoME::TB, year = 2007, wd = wd)wd <- tempdir() check_abundance(ResultDataTA = RoME::TA, ResultDataTB = RoME::TB, year = 2007, wd = wd)
The function works with data of a single year of survey and checks if TX files have the same area code.
check_area(DataTA, DataTB, DataTC, DataTE=NA, DataTL=NA, year, wd, suffix)check_area(DataTA, DataTB, DataTC, DataTE=NA, DataTL=NA, year, wd, suffix)
DataTA |
Haul data table according to MEDITS protocol (TA) |
DataTB |
Catch data table according to MEDITS protocol (TB) |
DataTC |
Biological data table according to MEDITS protocol (TC) |
DataTE |
Individual biological data table according to MEDITS protocol (TE) |
DataTL |
Litter data table according to MEDITS protocol (TL) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
TA, TB and TC tables are mandatory while TE and TL could be used where available.
The function returns TRUE if no error occurs, while FALSE is returned when there are differences in the AREA code among the TX tables.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTA = RoME::TA DataTB = RoME::TB DataTC = RoME::TC DataTE = RoME::TE DataTL = RoME::TL check_area(DataTA, DataTB,DataTC,DataTE=NA,DataTL=NA,year=2012, wd, suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTA = RoME::TA DataTB = RoME::TB DataTC = RoME::TC DataTE = RoME::TE DataTL = RoME::TL check_area(DataTA, DataTB,DataTC,DataTE=NA,DataTL=NA,year=2012, wd, suffix)
Check correctness of association between category and sub-category in TL consistent according to INSTRUCTION MANUAL VERSION 9
check_associations_category_TL(DataTL, assTL, year, wd, suffix)check_associations_category_TL(DataTL, assTL, year, wd, suffix)
DataTL |
Litter data table (TL) according to MEDITS protocol. |
assTL |
data frame with the association between TL (litter table) categories and sub-categories |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The package uses a table of association between TL categories and sub-categories that is resident in the data folder of the package as assTL.rda file.
The function returns always TRUE, because the outcome of the function is a warning that does not lock the execution of the 'RoME' checks. The presence of inconsistencies in the data is reported in the logfile stored in the "Logfiles"" subdirectory of the "wd"" user-defined directory.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTL = RoME::TL check_associations_category_TL(DataTL, assTL, year=2012, wd, suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTL = RoME::TL check_associations_category_TL(DataTL, assTL, year=2012, wd, suffix)
The function performs consistency checks of the values in the "BRIDLES_LENGTH" field of the hauls data table (TA).
check_bridles_length(DataTA, year, wd, suffix)check_bridles_length(DataTA, year, wd, suffix)
DataTA |
Haul data table according to MEDITS protocol (TA) |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
year |
reference year for the analysis |
The field BRIDLES_LENGTH can assume value 100 between 10-200 m of depth or 150 between 200-800 m. The function highlights also that MEDITS handbook recommends to increase the bridle length to 200 m in depths deeper than 500 m, reporting a warning in the logfile. Empty (NA) records in "BRIDLES_LENGTH" will be eliminated being the presence of empty fields already checked by check_no_empty_fields
The function returns always TRUE, because the outcome of the function is a warning that does not lock the execution of the 'RoME' checks. The presence of inconsistencies in the data is reported in the logfile stored in the "Logfiles"" subdirectory of the "wd"" user-defined directory.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" check_bridles_length(RoME::TA, year=2012, wd, suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" check_bridles_length(RoME::TA, year=2012, wd, suffix)
The function checks the class of the fields included in the selected table TX using the dictionary table reported in the class data frame.
check_class(data, tab, suffix, wd)check_class(data, tab, suffix, wd)
data |
one of the different data tables defined by the MEDITS protocol (TX) |
tab |
character string defining the type of table used in the analysis. Allowed values: "TA", "TB", "TC", "TE" and "TL". |
suffix |
Suffix string of the Logfile |
wd |
working directory path defined by the user |
The function returns TRUE if no error are detected, while FALSE value is returned if any of the checked fields in the selected table has a not expected class of data.
W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd = tempdir() check_class(data=RoME::TA, "TA", wd=wd,suffix="test_file") check_class(data=RoME::TB, "TB", wd=wd,suffix="test_file") check_class(data=RoME::TC, "TC", wd=wd,suffix="test_file") check_class(data=RoME::TE, "TE", wd=wd,suffix="test_file") check_class(data=RoME::TL, "TL", wd=wd,suffix="test_file")wd = tempdir() check_class(data=RoME::TA, "TA", wd=wd,suffix="test_file") check_class(data=RoME::TB, "TB", wd=wd,suffix="test_file") check_class(data=RoME::TC, "TC", wd=wd,suffix="test_file") check_class(data=RoME::TE, "TE", wd=wd,suffix="test_file") check_class(data=RoME::TL, "TL", wd=wd,suffix="test_file")
The function checks whether the distances reported in the haul data (TA) are consistent with the hauls duration.
check_consistencyTA_distance(DataTA, year, wd, suffix)check_consistencyTA_distance(DataTA, year, wd, suffix)
DataTA |
Haul data table according to MEDITS protocol (TA) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
Check between duration of the haul and distance (tolerance of 15%). The function does not check the presence of NA values in the DISTANCE field that are removed from the analysis. The eventual presence of empty records in the DISTANCE field is checked by the check_no_empty_fields function.
The function generates warning messages in the logfile and returns always TRUE.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd=tempdir() suffix="2020-03-05_time_h17m44s55" check_consistencyTA_distance(RoME::TA,year=2012,wd,suffix)wd=tempdir() suffix="2020-03-05_time_h17m44s55" check_consistencyTA_distance(RoME::TA,year=2012,wd,suffix)
The function checks whether the durations reported in the haul data (TA) are consistent with the differences between HAULING_TIME and SHOOTING_TIME.
check_consistencyTA_duration(DataTA, year, wd, suffix)check_consistencyTA_duration(DataTA, year, wd, suffix)
DataTA |
Haul data table according to MEDITS protocol (TA) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The DURATION, SHOOTING_TIME and HAULING_TIME fields have to be consistent
The function returns a boolean value. It is FALSE in case one or more durations in the TA table are not consistent with the differences between HAULING_TIME and SHOOTING_TIME.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" check_consistencyTA_duration(RoME::TA,year=2012,wd,suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" check_consistencyTA_duration(RoME::TA,year=2012,wd,suffix)
Check if in TB, TC and TE the date by haul is the same of the one reported in TA
check_date_haul(DataTA, Data, year, wd, suffix)check_date_haul(DataTA, Data, year, wd, suffix)
DataTA |
Haul data table according to MEDITS protocol (TA) |
Data |
Data frame of one of the following TX table: TB, TC, TE, TL |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The function check whether in one of the TX file allowed in Data argument there are date consistent with the one reported in the haul data table (TA).
The function returns TRUE if no error occurs, while FALSE is returned when in the Date data frame there is one or more date not included in the TA tables.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTA = RoME::TA Data = RoME::TB year=2009 check_date_haul(DataTA, Data, year, wd, suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTA = RoME::TA Data = RoME::TB year=2009 check_date_haul(DataTA, Data, year, wd, suffix)
Check if that difference between start depth and end depth is not greater than 20%
check_depth(DataTA, year, wd, suffix)check_depth(DataTA, year, wd, suffix)
DataTA |
Haul data table according to MEDITS protocol (TA) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The difference between start depth and end depth should be not greater than 20%.
The function returns always TRUE because the outcome of the function is a warning that does not block the execution of the 'RoME' checks. The presence of inconsistencies between start depth and end depth is reported in the logfile stored in the "Logfiles"" subdirectory of the "wd"" user-defined directory.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" check_depth(RoME::TA, year=2007,wd,suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" check_depth(RoME::TA, year=2007,wd,suffix)
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, suffix)check_dictionary(ResultData, Field, Values, year, wd, suffix)
ResultData |
Haul data table according to MEDITS protocol (TA) |
Field |
Name of the specific field of the selected TX table |
Values |
Vector of the allowed values for the field to be checked |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The function checks the consistence of the contained in specific fields with the relative allowed values. The check is performed on the hauls data table (TA), the catch data table (TB), the biological data table (TC) and the individual biological data (TE).
The function returns TRUE if no error occurs, while FALSE is returned when there are differences between the field values and the reference dictionaries. In the logfile is reported the list of all the records in which the inconsistency is detected.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" Field = "COURSE" Values = c("R","N") DataTA = RoME::TA year = 2007 check_dictionary(ResultData = DataTA, Field, Values, year, wd, suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" Field = "COURSE" Values = c("R","N") DataTA = RoME::TA year = 2007 check_dictionary(ResultData = DataTA, Field, Values, year, wd, suffix)
The function checks whether there are inconsistencies between the DISTANCE field values in the TA table and the distances computed from the geographical coordinates of each haul.
check_distance(DataTA, year, wd, suffix)check_distance(DataTA, year, wd, suffix)
DataTA |
Haul data table formatted according to the MEDITS protocol (TA table). |
year |
Reference year for the analysis. |
wd |
Working directory path defined by the user. |
suffix |
Suffix string to uniquely identify the output logfile and plots. |
The comparison between the DISTANCE field and the distance computed from shooting and hauling coordinates is performed with a tolerance threshold of 30%.
The geographic distance is calculated using the function distGeo() from the geosphere package, which computes the shortest path (great-circle distance) between two points on the Earth's ellipsoid (WGS84) using coordinates in decimal degrees.
Coordinates in the TA table are usually expressed in degrees and decimal minutes. These are automatically converted into decimal degrees using the internal function MEDITS.to.dd() before the computation.
The function always returns TRUE. Its purpose is to generate warnings for hauls where the recorded DISTANCE differs significantly from the computed geographic distance.
Warnings are saved in a logfile located in the Logfiles subdirectory of the specified working directory. Additionally, for hauls with discrepancies, graphical maps are generated and saved in the Graphs subdirectory to support visual inspection and correction.
W. Zupa, I. Bitetto
Anonymous. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
Hijmans, R. J. (2019). geosphere: Spherical Trigonometry. R package version 1.5-10.
https://cran.r-project.org/package=geosphere
wd <- tempdir() suffix <- "2020-03-05_time_h17m44s55" year <- 2007 check_distance(RoME::TA, year, wd, suffix)wd <- tempdir() suffix <- "2020-03-05_time_h17m44s55" year <- 2007 check_distance(RoME::TA, year, wd, suffix)
The function checks the values in "WING_OPENING" and "VERTICAL_OPENING" field are in the allowed ranges (see INSTRUCTION MANUAL VERSION 9 MEDITS 2017).
check_dm(DataTA, year, wd, suffix)check_dm(DataTA, year, wd, suffix)
DataTA |
Haul data table according to MEDITS protocol (TA) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The value ranges defined in the INSTRUCTION MANUAL VERSION 9 MEDITS (2017) for wing and vertical opening expressed in dm are respectively 50 - 250 and 10 - 100.
The function returns an error in case wing values are out of the allowed ranges, while it returns warnings in case vertical opening values are out of the allowed ranges and in case wing opening and vertical opening values are not integer numbers.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd=tempdir() suffix="2020-12-16_time_h10m52s55" check_dm(RoME::TA,year=2007,wd,suffix)wd=tempdir() suffix="2020-12-16_time_h10m52s55" check_dm(RoME::TA,year=2007,wd,suffix)
Check if for G1 and G2 species the length measurements are present in TC
check_G1_G2(DataTC, year, wd, suffix)check_G1_G2(DataTC, year, wd, suffix)
DataTC |
Biological data table according to MEDITS protocol (TC) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
This check uses a new support table (list_g1_g2) containing the list of MEDITS G1 and G2 species and verify if the length has been collected for the selected species for each haul. If the length is lacking for any species in any haul, a warning message is given in the logfile.
The function returns always TRUE because the outcome of the function is a warning that does not block the execution of the 'RoME' checks. If the length is lacking for any species in any haul, a warning message is given in the logfile.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" check_G1_G2(RoME::TC,year=2007,wd,suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" check_G1_G2(RoME::TC,year=2007,wd,suffix)
The function checks whether all the species present in TC (biological data table) must be listed in TB (catch data table)
check_haul_species_TCTB(DataTB, DataTC, year, wd, suffix)check_haul_species_TCTB(DataTB, DataTC, year, wd, suffix)
DataTB |
catch data table according to MEDITS protocol (TB) |
DataTC |
Biological data table according to MEDITS protocol (TC) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The function returns a warning message in the logfile.
If a species present in the TC table (biological data table) is not reported in the TB (catch data table) an error message is reported in the logfile and a "Critical_errors" file is saved in the working directory reporting details on the errors.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" year=2008 check_haul_species_TCTB(RoME::TB, RoME::TC, year, wd, suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" year=2008 check_haul_species_TCTB(RoME::TB, RoME::TC, year, wd, suffix)
The function check the presence of the TA (haul data table) hauls in the TB (catch data table)
check_hauls_TATB(DataTA,DataTB,year,wd,suffix)check_hauls_TATB(DataTA,DataTB,year,wd,suffix)
DataTA |
Haul data table according to MEDITS protocol (TA) |
DataTB |
Catch data table according to MEDITS protocol (TB) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The function check the presence of the TA (haul data table) hauls in the TB (catch data table)
The function returns TRUE if no error occurs, while FALSE is returned when an inconsistency is detected between haul and catch tables.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTA <- RoME::TA DataTB <- RoME::TB year = 2008 check_hauls_TATB(DataTA,DataTB,year,wd,suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTA <- RoME::TA DataTB <- RoME::TB year = 2008 check_hauls_TATB(DataTA,DataTB,year,wd,suffix)
Check if the hauls in TA are present in TL
check_hauls_TATL(DataTA, DataTL, year, wd, suffix)check_hauls_TATL(DataTA, DataTL, year, wd, suffix)
DataTA |
Haul data table according to MEDITS protocol (TA) |
DataTL |
Litter data table according to MEDITS protocol (TL) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The function checks whether all the hauls present in hauls data table (TA) are included in the litter data table (TL).
The function returns always TRUE because the outcome of the function is a warning that does not lock the execution of the 'RoME' checks. The list of the hauls not present in the TL table is reported in the logfile stored in the "Logfiles"" subdirectory of the "wd" user-defined directory.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTA = RoME::TA DataTL = RoME::TL year=2008 check_hauls_TATL(DataTA,DataTL,year,wd,suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTA = RoME::TA DataTL = RoME::TL year=2008 check_hauls_TATL(DataTA,DataTL,year,wd,suffix)
The function check the presence of the TB (catch data table) hauls in the TA (haul data table)
check_hauls_TBTA(DataTA, DataTB, year, wd, suffix)check_hauls_TBTA(DataTA, DataTB, year, wd, suffix)
DataTA |
Haul data table according to MEDITS protocol (TA) |
DataTB |
Catch data table according to MEDITS protocol (TB) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The function check the presence of the TB (catch data table) hauls in the TA (haul data table)
The function returns TRUE if no error occurs, while FALSE is returned when an inconsistency is detected between haul and catch tables.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTA <- RoME::TA DataTB <- RoME::TB check_hauls_TBTA(DataTA,DataTB,year=2008,wd,suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTA <- RoME::TA DataTB <- RoME::TB check_hauls_TBTA(DataTA,DataTB,year=2008,wd,suffix)
Check if the hauls in TL are present in TA
check_hauls_TLTA(DataTA,DataTL,year,wd,suffix)check_hauls_TLTA(DataTA,DataTL,year,wd,suffix)
DataTA |
Haul data table according to MEDITS protocol (TA) |
DataTL |
Litter data table according to MEDITS protocol (TL) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The function checks whether all the hauls present in litter data table (TL) are included in the haul data table (TA).
The function returns TRUE if no error occurs, while FALSE is returned when there are missing hauls in the TA table.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTA = RoME::TA DataTL = RoME::TL year=2008 check_hauls_TLTA(DataTA,DataTL,year,wd,suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTA = RoME::TA DataTL = RoME::TL year=2008 check_hauls_TLTA(DataTA,DataTL,year,wd,suffix)
The function checks whether there is one or more identical records in the selected type of table (TX).
check_identical_records(Data, year, wd, suffix)check_identical_records(Data, year, wd, suffix)
Data |
one of the different data tables defined by the MEDITS protocol (TX) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The routine uses all the table format (TX) defined by the MEDITS protocol.
The function returns TRUE if no error occurs, while FALSE is returned when there is one or more identical record in the given TX table.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" Data = RoME::TA check_identical_records(Data, year=2007, wd, suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" Data = RoME::TA check_identical_records(Data, year=2007, wd, suffix)
The function compares the observed
check_individual_weightTC(DataTC,LW=NA,year,wd,suffix,verbose=FALSE)check_individual_weightTC(DataTC,LW=NA,year,wd,suffix,verbose=FALSE)
DataTC |
Biological data table according to MEDITS protocol (TC) |
LW |
data frame of the a and b parameters by species, area and sex |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
verbose |
boolean parameter, if TRUE returns messages about the progress of the elaboration |
The warning is given when difference between the sum of estimated individual weights (by haul, species and sub-samples) and the WEIGHT_OF_THE_SAMPLE_MEASURED is greater than 50% for at least one record. This check is based on the table LW contained in package, where the length-weight relationship coefficients are reported by species, area and sex.
The file Comparison_estimated_observed_weight_in_TC.csv is automatically saved in the working directory in order to easily detect the samples with this differences in total weight. For all the records the percentage difference between observed and estimated weight is reported.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" TC = RoME::TC[1:20,] check_individual_weightTC(DataTC=TC,year=2007, wd=wd, suffix=suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" TC = RoME::TC[1:20,] check_individual_weightTC(DataTC=TC,year=2007, wd=wd, suffix=suffix)
The function checks the difference between observed and estimated individual weight in percentage.
check_individual_weightTE(DataTE,LW,year, wd, suffix,verbose=FALSE)check_individual_weightTE(DataTE,LW,year, wd, suffix,verbose=FALSE)
DataTE |
Individual biological data table according to MEDITS protocol (TE) |
LW |
data frame of the length-weight parameters by species, area and sex |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
verbose |
boolean parameter, if TRUE returns messages about the progress of the elaboration |
For each individual is calculated the estimated weight according to length-weight relationship coefficient stored in LW table and the difference between observed and estimated individual weight in percentage. Moreover, this function checks if for G1 species has been collected the weight or if has been entered the value ND, that is not allowed.
If for at least one record the difference between observed and estimated individual weight is greater than 20% a warning is given in Logfile.dat and a table named TE_with_estimated_weights.csv is automatically produced in order to allow the user to easily eventually detect the errors. For all the records the percentage difference between observed and estimated weight is reported.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTE = RoME::TE[1:6,] check_individual_weightTE(DataTE,year=2012, wd=wd, suffix=suffix,verbose=TRUE)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTE = RoME::TE[1:6,] check_individual_weightTE(DataTE,year=2012, wd=wd, suffix=suffix,verbose=TRUE)
The function checks the consistency of length classes in the TC table for the MEDITS survey. It verifies that the recorded length classes for each species fall within the expected ranges reported in a reference table of species-specific length limits. Warnings for inconsistencies are written to a CSV file for easier downstream analysis instead of being printed extensively in the log file.
check_length(DataTC, DataSpecies = NA, year, wd, suffix, DataTargetSpecies = RoME::DataTargetSpecies)check_length(DataTC, DataSpecies = NA, year, wd, suffix, DataTargetSpecies = RoME::DataTargetSpecies)
DataTC |
Biological data table (TC) formatted according to the MEDITS protocol. |
DataSpecies |
A data frame with species-specific reference length
limits. If not provided, the internal |
year |
Reference year for the analysis. |
wd |
Working directory path defined by the user, where log files and CSV output will be saved. |
suffix |
Suffix string for naming the log and CSV files, allowing unique identification of output files from different runs. |
DataTargetSpecies |
Reference dataset with species-specific
information on length ranges, used as default if
|
The function filters the TC data for the selected year and checks each
length class recorded against the minimum (LMIN01) and maximum
(LMAX99) length values defined for the corresponding species in
the reference table. It also checks for negative or missing length
class values. All detected issues are collected and saved in a CSV file
for clear reporting, instead of generating verbose outputs in the log
file.
Species with less than 50 observations in TC are excluded from the check
by default, to focus the analysis on more frequently recorded species.
The function ensures robust handling of missing (NA) values in
both the TC table and the reference datasets to avoid false warnings.
A short summary of the check results is written to the .dat
logfile. If no inconsistencies are detected, a message indicating
successful validation is saved.
Returns TRUE, invisibly. Detected inconsistencies are written to
a CSV file in the working directory; if no issues are found, the CSV
file remains empty apart from the header row.
W. Zupa, I. Bitetto
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() DataTC <- RoME::TC[1:20,] DataSpecies <- NA suffix <- "2020-03-05_time_h17m44s55" check_length(DataTC, DataSpecies = NA, year = 2007, wd, suffix)wd <- tempdir() DataTC <- RoME::TC[1:20,] DataSpecies <- NA suffix <- "2020-03-05_time_h17m44s55" check_length(DataTC, DataSpecies = NA, year = 2007, wd, suffix)
The function checks the consistency of field LENGTH_CLASSES_CODE in TC
check_length_class_codeTC(DataTC,Specieslist=RoME::TM_list,year,wd,suffix)check_length_class_codeTC(DataTC,Specieslist=RoME::TM_list,year,wd,suffix)
DataTC |
Biological data table according to MEDITS protocol (TC) |
Specieslist |
Information related to target species as reported in the TM list |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The function checks whether the LENGTH_CLASS_CODE by species are consistent with those reported in the Specieslist dataset. When Specieslist is NA the TM_list dataset (included in the package) is used by default.
If the LENGTH_CLASS_CODE in TC table (biological data table) are not consistent with CODLON field in Specieslist dataset (or TM_list if Specieslist is NA) an error is returned. In case a LENGTH_CLASS_CODE is not reported for the given species no check is done and the function returns a warning message.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
DataTC <- RoME::TC wd=tempdir() suffix= "2020-03-05_time_h17m44s55" check_length_class_codeTC(DataTC,Specieslist=NA,year=2007,wd,suffix)DataTC <- RoME::TC wd=tempdir() suffix= "2020-03-05_time_h17m44s55" check_length_class_codeTC(DataTC,Specieslist=NA,year=2007,wd,suffix)
Consistency check of maturity stages, according to the faunistic category and sex
check_mat_stages(Data, year, wd, suffix, stages = RoME::mat_stages)check_mat_stages(Data, year, wd, suffix, stages = RoME::mat_stages)
Data |
Biological data table (TC) or individual biological data table (TE) according to MEDITS protocol |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
stages |
data frame with the list of allowed maturity stages for faunistic category as defined by the mat_stages dataset included in the package |
The check on maturity stage is performed for the species included in the new TM list, where selachians and bony fish are distinguished. The check is applied to the following faunistic categories: Ao, Ae, B, C and Bst.
The function always returns TRUE generating a warning message when inconsistencies in the maturity stages are detected, being difficult to define for all GSAs the year in which occurred the switch from the "old" MEDITS maturity scale to the current MEDITS scale.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
DataTC <- RoME::TC wd=tempdir() suffix= "2020-03-05_time_h17m44s55" check_mat_stages(DataTC,year=2007, wd, suffix)DataTC <- RoME::TC wd=tempdir() suffix= "2020-03-05_time_h17m44s55" check_mat_stages(DataTC,year=2007, wd, suffix)
The function checks the consistency of the number of individuals by sex measured (NO_OF_INDIVIDUAL_OF_THE_ABOVE_SEX_MEASURED field in the biological data table, TC) with the sum of the individuals by sex, length class and maturity stage (NUMBER_OF_INDIVIDUALS_IN_THE_LENGTH_CLASS_AND_MATURITY_STAGE field in TC)
check_nb_per_sexTC(DataTC, year, wd, suffix)check_nb_per_sexTC(DataTC, year, wd, suffix)
DataTC |
Biological data table according to MEDITS protocol (TC) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The function checks the consistency of the number of individuals by sex measured (NO_OF_INDIVIDUAL_OF_THE_ABOVE_SEX_MEASURED field in the biological data table, TC) with the sum of the individuals by sex, length class and maturity stage (NUMBER_OF_INDIVIDUALS_IN_THE_LENGTH_CLASS_AND_MATURITY_STAGE field in TC)
The function returns TRUE if no error occurs, while FALSE is returned when there inconsistencies between the following biological data table (TC): NO_OF_INDIVIDUAL_OF_THE_ABOVE_SEX_MEASURED and NUMBER_OF_INDIVIDUALS_IN_THE_LENGTH_CLASS_AND_MATURITY_STAGE.If the field number per sex is found completely empty, the routine will stop and will produce automatically a .csv file (TC_file_with_computed_nb_per_sex.csv) with the nb per sex column filled in. The user will have to copy and paste the column in the original file and run again the code.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTC = RoME::TC year=2007 check_nb_per_sexTC(DataTC,year,wd,suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTC = RoME::TC year=2007 check_nb_per_sexTC(DataTC,year,wd,suffix)
The function checks the consistency of number of individuals sampled for weight and ageing in TE
check_nb_TE(DataTE, year, wd, suffix)check_nb_TE(DataTE, year, wd, suffix)
DataTE |
Individual biological data table according to MEDITS protocol (TE) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
this function verify the consistency of the check-fields:
NO_PER_SEX_MEASURED_IN_SUB_SAMPLE_FOR_OTOLITH
NO_PER_SEX_MEASURED_IN_SUB_SAMPLE_FOR_WEIGHT
NO_PER_SEX_MEASURED_IN_SUBSAMPLE_FOR_AGEING
These fields are compared to the number of records present in TE by sex, length class and haul.
The function returns FALSE in case inconsistencies are detected in the individual biological data table (TE)
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTE = RoME::TE year=2012 check_nb_TE(DataTE,year, wd, suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTE = RoME::TE year=2012 check_nb_TE(DataTE,year, wd, suffix)
The function checks that the total number of individuals is consistent with the sum of the individuals per sex
check_nbtotTB(DataTB, year, wd, suffix)check_nbtotTB(DataTB, year, wd, suffix)
DataTB |
Catch data table according to MEDITS protocol (TB) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The function checks that the total number of individuals is consistent with the sum of the individuals per sex
The function returns TRUE if no error occurs, FALSE if one or more inconsistencies in the individuals number is detected.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTB = RoME::TB year=2007 check_nbtotTB(DataTB,year, wd, suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTB = RoME::TB year=2007 check_nbtotTB(DataTB,year, wd, suffix)
Check if in TB there are the total number, number of females, males and undetermined for species G1
check_nm_TB(DataTB, year, wd, suffix)check_nm_TB(DataTB, year, wd, suffix)
DataTB |
Catch data table according to MEDITS protocol (TB) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
for the species G1 are not allowed that the fields related to total number, number of females, number of males and number of undetermined are simultaneously null, according to MEDITS manual version 9 of 2017.
The function returns TRUE if no error occurs, FALSE if one or more inconsistencies in the individuals number per sex in TB is detected.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTB = RoME::TB year=2007 check_nm_TB(DataTB, year, wd, suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTB = RoME::TB year=2007 check_nm_TB(DataTB, year, wd, suffix)
All the fields, except to HYDROLOGICAL_STATION and OBSERVATIONS, must be not empty for valid hauls
check_no_empty_fields(Data, year, wd, suffix)check_no_empty_fields(Data, year, wd, suffix)
Data |
one of the different data tables defined by the MEDITS protocol (TX) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The routine uses all the table format (TX) defined by the MEDITS protocol.
The function returns TRUE if no error occurs, while FALSE is returned when there is one or more empty record in the given TX table.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" Data = RoME::TA year=2007 check_no_empty_fields(Data, year, wd, suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" Data = RoME::TA year=2007 check_no_empty_fields(Data, year, wd, suffix)
The function checks whether the values contained in specific fields are consistent within the allowed range of values.
check_numeric_range(Data, Field, Values, year, wd, suffix)check_numeric_range(Data, Field, Values, year, wd, suffix)
Data |
data table according to MEDITS protocol (TX) |
Field |
Name of the specific field of the selected TX table |
Values |
Vector of the allowed values for the field to be checked. The first two values are mandatory and indicate the extreme values of the range. The other optional values are single numerical exceptions to the field allowed values. |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The function checks the consistence of the values contained in specific fields with the relative allowed range of values. The function allows to include exceptions to the allowed range of values for specific values. The check is performed on any of the "TX" data tables.
The function returns TRUE if no error occurs, while FALSE is returned when inconsistencies are detected. The list of all the records in which the inconsistency is detected is reported in the logfile.
W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" Field = "SHOOTING_DEPTH" Values = c(10,800,0) Data = RoME::TA year <- unique(Data$YEAR)[1] check_numeric_range(Data, Field, Values, year, wd, suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" Field = "SHOOTING_DEPTH" Values = c(10,800,0) Data = RoME::TA year <- unique(Data$YEAR)[1] check_numeric_range(Data, Field, Values, year, wd, suffix)
The function generate three different plots, haul start position, haul end position and start and end positions together.
check_position(DataTA, year, wd, suffix)check_position(DataTA, year, wd, suffix)
DataTA |
Haul data table according to MEDITS protocol (TA) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The haul position maps are saved in the Graph directory allocated in the user defined wd directory.
The function generate three maps of the haul position that are stored in the Graph folder allocated in the user defined wd directory
W. Zupa, I. Bitetto
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" year=2007 check_position(RoME::TA,year,wd,suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" year=2007 check_position(RoME::TA,year,wd,suffix)
The function checks whether the position of the haul is in the Mediterranean Sea area or falls on the land.
check_position_in_Med(DataTA, year, wd, suffix)check_position_in_Med(DataTA, year, wd, suffix)
DataTA |
Haul data table according to MEDITS protocol (TA) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The function uses the haul_at_sea() function to check whether the position of the haul is in the Mediterranean Sea area or falls on the land.
The function returns a boolean value. It is FALSE in case one or more haul positions fall out of the Mediterranean Sea area defined by the shapefile MedSea included in the package.
W. Zupa, I. Bitetto
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time h17m44s55" DataTA = RoME::TA year=2007 check_position_in_Med(DataTA, year, wd, suffix)wd <- tempdir() suffix="2020-03-05_time h17m44s55" DataTA = RoME::TA year=2007 check_position_in_Med(DataTA, year, wd, suffix)
Function checking that the shooting quadrant and the hauling quadrant are the same.
check_quadrant(ResultDataTA,year,wd,suffix)check_quadrant(ResultDataTA,year,wd,suffix)
ResultDataTA |
Haul data table according to MEDITS protocol (TA). |
year |
reference year for the analysis |
wd |
Working directory selected by the user. |
suffix |
Suffix string of the Logfile. |
The function returns a warning if shooting and hauling quadrant are not the same.
The function returns always TRUE, because the outcome of the function is a warning that does not lock the execution of the 'RoME' checks. The presence of inconsistencies in the data is reported in the logfile stored in the "Logfiles" subdirectory of the "wd" user-defined directory.
I. Bitetto, W. Zupa
For the definition of the quadrants, please refer to: Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd=tempdir() suffix= "2020-03-05_time_h17m44s55" TA <- RoME::TA year=2007 check_quadrant(TA,year,wd,suffix)wd=tempdir() suffix= "2020-03-05_time_h17m44s55" TA <- RoME::TA year=2007 check_quadrant(TA,year,wd,suffix)
Two or more "quasi-identical records" occurred when all the fields are respectively equal, except: TYPE_OF_FILE, AREA, GEAR, VESSEL, YEAR, RIGGING, DOORS, for TA table; TYPE_OF_FILE, AREA, VESSEL, YEAR for TB and TC tables.These specific fields are allowed to be identical.
check_quasiidentical_records(Result,year,wd,suffix)check_quasiidentical_records(Result,year,wd,suffix)
Result |
Haul data table according to MEDITS protocol (TA), or Catch data table (TB) or Biological data table (TC). |
year |
reference year for the analysis |
wd |
Working directory selected by the user. |
suffix |
Suffix string of the Logfile. |
The checks always returns TRUES generating warning messages in the logfile if any quasi-identical record was found. In a given survey the following fields (of TA table) should be identical: 'TYPE_OF_FILE', 'AREA', 'VESSEL', 'GEAR', 'RIGGING', 'DOORS' and 'YEAR'. The function checks whether any differences occur in these fields in each yearly survey. The same think is done for all the other tables where these fields occur.
The function always returns TRUE reporting the presence of quasi-identical records in the logfile.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd=tempdir() suffix= "2020-03-05_time_h17m44s55" year=2007 # example using TA table TA <- RoME::TA check_quasiidentical_records(TA,year,wd,suffix) # example using TB table TB <- RoME::TB check_quasiidentical_records(TB,year,wd,suffix) # example using TC table TC <- RoME::TC check_quasiidentical_records(TC,year,wd,suffix)wd=tempdir() suffix= "2020-03-05_time_h17m44s55" year=2007 # example using TA table TA <- RoME::TA check_quasiidentical_records(TA,year,wd,suffix) # example using TB table TB <- RoME::TB check_quasiidentical_records(TB,year,wd,suffix) # example using TC table TC <- RoME::TC check_quasiidentical_records(TC,year,wd,suffix)
TB and TC filescheck_raising() performs a suite of integrity checks on a pair of MEDITS
survey tables – TB (catch-at-haul) and TC (biological subsamples) – for
one survey year. All inconsistencies are written to a plain-text logfile; the
routine never stops at the first error, so you always get the full list of
issues detected.
check_raising(ResultDataTB, ResultDataTC, year, wd, suffix = NULL)check_raising(ResultDataTB, ResultDataTC, year, wd, suffix = NULL)
ResultDataTB |
A |
ResultDataTC |
A |
year |
Single integer. The survey year to be checked. |
wd |
Character string. A writable directory where sub-folders ‘Logfiles/’ (and ‘Graphs/’, currently unused) will be created. |
suffix |
Optional character string appended to the logfile name. When
|
The function executes five independent validations:
Weight consistency – When more than one subsample exists for a
given haul/species in TC, the sum of
WEIGHT_OF_THE_FRACTION must equal TOTAL_WEIGHT_IN_THE_HAUL
recorded in TB.
Raising factor – For each subsample the ratio given by WEIGHT_OF_THE_FRACTION / WEIGHT_OF_THE_SAMPLE_MEASURED must be .
Sex-specific numbers – For every combination
haul * species * sex the raised total of individuals in TC
must match TB columns NB_OF_FEMALES, NB_OF_MALES
or NB_OF_UNDETERMINED.
Total individuals (TC -> TB) – For every haul/species the sum of
raised numbers across all sexes in TC must equal
TOTAL_NUMBER_IN_THE_HAUL in TB. This catches cases where
an entire sex is missing from TC.
Internal TB consistency – Within TB the sum of the three
sex-specific columns must equal TOTAL_NUMBER_IN_THE_HAUL for each
haul/species.
If any of these checks fails, an explanatory line is appended to the logfile
‘Logfiles/Logfile_.dat’. The function finally returns a single
logical value: TRUE when no errors are detected, FALSE otherwise.
Tidy-evaluation is used inside the dplyr pipelines; the following symbols
are declared in globalVariables to avoid "no visible binding"
notes during R CMD check:
COUNTRY, YEAR, HAUL_NUMBER, GENUS, SPECIES,
WEIGHT_OF_THE_FRACTION, WEIGHT_OF_THE_SAMPLE_MEASURED,
NUMBER_OF_INDIVIDUALS_IN_THE_LENGTH_CLASS_AND_MATURITY_STAGE, SEX,
NB_OF_FEMALES, NB_OF_MALES, NB_OF_UNDETERMINED,
TOTAL_WEIGHT_IN_THE_HAUL, TOTAL_NUMBER_IN_THE_HAUL,
codedsex, N, molt, raised, RaisedSex,
RaisedTotal, n_subsamples, total_fraction,
SumSexTB.
Logical scalar: TRUE if the dataset passes all checks, FALSE
otherwise.
W. Zupa, I. Bitetto, M. T. Spedicato
dplyr for the data-manipulation verbs used under
the hood.
# The following datasets come from the 'RoME' package demo data DataTB <- RoME::TB DataTC <- RoME::TC res <- check_raising(DataTB, DataTC, year = 2015, wd = tempdir()) if (res) message("All checks passed!")# The following datasets come from the 'RoME' package demo data DataTB <- RoME::TB DataTC <- RoME::TC res <- check_raising(DataTB, DataTC, year = 2015, wd = tempdir()) if (res) message("All checks passed!")
The TM list contained in the INSTRUCTION MANUAL VERSION 9 MEDITS 2017 is taken as reference to check the correctness of species code and category.The function is applied to catch data table (TB), Biological data table (TC) and Individual data table (TE).
check_rubincode(ResultData,year,TMlist,wd,suffix)check_rubincode(ResultData,year,TMlist,wd,suffix)
ResultData |
alternatively: Catch data table (TB), Biological data table (TC) and Individual data table (TE). |
year |
reference year for the analysis |
TMlist |
TM_list reference list |
wd |
Working directory selected by the user. |
suffix |
Suffix string of the Logfile. |
The checks execution is stopped if any mismatching record was found.
The function returns always TRUE if used to check TB tables, indicating in the logfile the species codes not present in TM list. If unexpected rubin codes are detected in both TC and TE tables an error (FALSE value) is reported in the logfile, interrupting the function running.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd=tempdir() suffix= "2020-03-05_time_h17m44s55" year=2007 # example using TB table TB <- RoME::TB check_rubincode(TB,year,TM_list,wd,suffix) # example using TC table TC <- RoME::TC check_rubincode(TC,year,TM_list,wd,suffix)wd=tempdir() suffix= "2020-03-05_time_h17m44s55" year=2007 # example using TB table TB <- RoME::TB check_rubincode(TB,year,TM_list,wd,suffix) # example using TC table TC <- RoME::TC check_rubincode(TC,year,TM_list,wd,suffix)
This function verifies the consistency of maturity information in TC data by detecting mature individuals whose lengths are smaller than the smallest mature size reported in the literature for each species and sex. Detected inconsistencies are saved in a CSV file for traceability and further review, while a concise summary is written in the log file.
check_smallest_mature(ResultData, year, MaturityParameters, TargetSpecies, wd, suffix)check_smallest_mature(ResultData, year, MaturityParameters, TargetSpecies, wd, suffix)
ResultData |
Biological data table (TC) formatted according to the MEDITS protocol. This table should contain length-class, sex, and maturity stage information for all recorded hauls. |
year |
Reference year for the analysis. Only records from the specified year are processed. |
MaturityParameters |
Table with bibliographic parameters describing the smallest mature individual observed for each species and sex, and the related reference sources. |
TargetSpecies |
Table containing information on target species, including taxonomic codes and faunistic categories used to identify relevant maturity checks. |
wd |
Working directory where the function writes log files and CSV outputs. |
suffix |
String appended to filenames of log and CSV files to distinguish outputs from different runs. |
The function processes the TC data for the selected year and examines each
species listed in the MaturityParameters table. For each mature
individual (i.e.\ not coded as immature stages), it checks whether the
length class is smaller than the bibliographic minimum threshold,
allowing a 10% tolerance buffer to account for biological variability.
If such individuals are detected, they are recorded in a CSV file
including:
GSA
Year
Species
Sex
Haul number
Length class (mm)
Threshold applied (mm)
Literature threshold (mm)
Bibliographic reference
Type of file
Type of warning
A concise message summarizing how many records were written to the CSV is
printed to the log file (.dat). If no inconsistencies are found,
the function logs a message indicating that all maturity stages are above
bibliographic thresholds.
The check uses the updated DataTargetSpecies table for consistency
with current species definitions and codes.
The function always returns TRUE. Its purpose is to perform quality
checks and log potential issues, but it does not interrupt the execution
of other routines in the RoME package.
W. Zupa, I. Bitetto
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix <- "2020-03-05_time_h17m44s55" TC <- RoME::TC year <- 2007 check_smallest_mature( TC, year, RoME::Maturity_parameters, RoME::DataTargetSpecies, wd, suffix )wd <- tempdir() suffix <- "2020-03-05_time_h17m44s55" TC <- RoME::TC year <- 2007 check_smallest_mature( TC, year, RoME::Maturity_parameters, RoME::DataTargetSpecies, wd, suffix )
This function checks whether maturity stages reported in TC (or TE) are consistent with the reproductive period of each species. It detects three situations:
Immature individuals caught during the spawning period but with lengths above the bibliographic threshold (maximum L50 plus 20%).
Mature individuals caught outside the spawning period.
Mature individuals caught outside the spawning period and with lengths smaller than the smallest mature individual reported in the literature.
The check uses bibliographic information from the Maturity_parameters table, including L50 values and spawning months.
check_spawning_period(ResultDataTA, ResultDataTC, year, Maturity_parameters, DataTargetSpecies, wd, suffix)check_spawning_period(ResultDataTA, ResultDataTC, year, Maturity_parameters, DataTargetSpecies, wd, suffix)
ResultDataTA |
Haul data table (TA) according to MEDITS protocol. |
ResultDataTC |
Biological data table (TC) or alternatively the individual data table (TE), according to MEDITS protocol. |
year |
Reference year for the analysis. |
Maturity_parameters |
Table containing bibliographic information on L50, reproductive season, and smallest mature size for species and sexes. |
DataTargetSpecies |
Reference table for target species, including faunistic categories and other relevant data. |
wd |
Working directory selected by the user, where logfiles and CSV outputs will be saved. |
suffix |
Suffix string to append to output filenames, useful to distinguish between multiple runs. |
The function reads information from Maturity_parameters to identify the reproductive period (spawning season) of each species and sex. It then compares each record in TC or TE with these periods:
Immature individuals (maturity codes 0, 1, 2A) are flagged if they are captured during the spawning period and have lengths exceeding the bibliographic threshold (maximum L50 + 20%).
Mature individuals are checked to verify whether they were caught outside the defined spawning period.
Among mature individuals outside the spawning period, those with lengths smaller than the smallest mature specimen reported in literature are additionally flagged.
Warnings are written both to a .dat logfile and to a CSV file for easier downstream analysis. The CSV output includes details on GSA, year, haul number, species, sex, length class, spawning period months, month of capture, and type of warning.
The function always returns TRUE, as it is designed to produce warnings rather than halt execution of further routines in the RoME package.
W. Zupa, I. Bitetto
Anonymous. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix <- "2020-03-05_time_h17m44s55" year <- 2007 TA <- RoME::TA TC <- RoME::TC check_spawning_period( ResultDataTA = TA, ResultDataTC = TC, year = year, Maturity_parameters = RoME::Maturity_parameters, DataTargetSpecies = RoME::DataTargetSpecies, wd = wd, suffix = suffix )wd <- tempdir() suffix <- "2020-03-05_time_h17m44s55" year <- 2007 TA <- RoME::TA TC <- RoME::TC check_spawning_period( ResultDataTA = TA, ResultDataTC = TC, year = year, Maturity_parameters = RoME::Maturity_parameters, DataTargetSpecies = RoME::DataTargetSpecies, wd = wd, suffix = suffix )
This function verifies the presence of the target species (that is a subset of the all the species caught, reported in TB), in the TC table, where additional information (apart from number and weight) are collected.
check_species_TBTC(ResultTB,ResultTC,year,DataSpecies,wd,suffix)check_species_TBTC(ResultTB,ResultTC,year,DataSpecies,wd,suffix)
ResultTB |
Catch data table(TB). |
ResultTC |
Biological data table (TC). |
year |
reference year for the analysis |
DataSpecies |
Information related to target species. |
wd |
Working directory selected by the user. |
suffix |
Suffix string of the Logfile. |
This function gives a warning message, thus the execution is not stopped when some target species are lacking in TC; the user is informed in the Logfile.
The function returns always TRUE, because the outcome of the function is a warning that does not lock the execution of the 'RoME' checks.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd=tempdir() suffix = "2020-03-05_time_h17m44s55" year=2007 ResultTB=RoME::TB ResultTC=RoME::TC check_species_TBTC(ResultTB,ResultTC,year,RoME::DataTargetSpecies,wd,suffix)wd=tempdir() suffix = "2020-03-05_time_h17m44s55" year=2007 ResultTB=RoME::TB ResultTC=RoME::TC check_species_TBTC(ResultTB,ResultTC,year,RoME::DataTargetSpecies,wd,suffix)
Fishes and cephalopods length classes must have full or half step (in case of LENGTH_CLASSES_CODE=1 only full). All the measures , must be integer numbers.
check_step_length_distr(ResultData,year,wd,suffix)check_step_length_distr(ResultData,year,wd,suffix)
ResultData |
alternatively: Biological data table (TC) and Individual data table (TE). |
year |
reference year for the analysis |
wd |
Working directory selected by the user. |
suffix |
Suffix string of the Logfile. |
According to the MEDITS protocol, Fishes and cephalopods length measurement must collected full or half step and all the measures, must be integer numbers. Empty (NA) records in LENGHT_CLASS field are removed from the analysis being empty fields already detected by check_no_empty_fields function.
The function returns TRUE if no error occurs, while FALSE is returned when the step is not correctly used. In the logfile is reported the list of all the records in which the inconsistency is detected.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
data <- RoME::TC wd=tempdir() year = 2007 suffix= "2020-03-05_time_h17m44s55" check_step_length_distr(data,year,wd,suffix)data <- RoME::TC wd=tempdir() year = 2007 suffix= "2020-03-05_time_h17m44s55" check_step_length_distr(data,year,wd,suffix)
Start depth and end depth of each haul should be in the same stratum.
check_stratum(ResultData,year,wd,suffix)check_stratum(ResultData,year,wd,suffix)
ResultData |
Haul data table according to MEDITS protocol (TA). |
year |
reference year for the analysis |
wd |
Working directory selected by the user. |
suffix |
Suffix string of the Logfile. |
Start depth and end depth of each haul should be in the same stratum. The strata are the ones defined according to the MEDITS protocol: 10-15 m; 50-100 m; 100-200 m; 200-500m; 500-800 m.
The function returns always TRUE, because the outcome of the function is a warning that does not lock the execution of the 'RoME' checks. The presence of inconsistencies in the data is reported in the logfile stored in the "Logfiles" subdirectory of the "wd" user-defined directory.
I. Bitetto, W. Zupa
For the definition of the strata, please refer to: Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd=tempdir() year=2007 TA = RoME::TA suffix= "2020-03-05_time_h17m44s55" check_stratum(TA,year,wd,suffix)wd=tempdir() year=2007 TA = RoME::TA suffix= "2020-03-05_time_h17m44s55" check_stratum(TA,year,wd,suffix)
This function verifies the correctness of the stratum code, following the stratification scheme table in the MEDITS protocol.
check_stratum_code(ResultDataTA,year,Strata,wd,suffix)check_stratum_code(ResultDataTA,year,Strata,wd,suffix)
ResultDataTA |
Haul data table according to MEDITS protocol (TA). |
year |
reference year for the analysis |
Strata |
Stratification scheme according to MEDITS protocol. |
wd |
Working directory selected by the user. |
suffix |
Suffix string of the Logfile. |
This function checks if the stratum code associated to each haul is consistent with the code reported in MEDITS manual and in the table Stratification scheme, corresponding to the associated depth range.
The function returns always TRUE, because the outcome of the function is a warning that does not lock the execution of the 'RoME' checks. The presence of inconsistencies in the data is reported in the logfile stored in the "Logfiles" subdirectory of the "wd" user-defined directory.
I. Bitetto, W. Zupa
For the definition of the strata, please refer to: Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
TA = RoME::TA wd=tempdir() year = 2007 suffix= "2020-03-05_time_h17m44s55" check_stratum_code(TA,year,Strata=RoME::stratification_scheme,wd,suffix)TA = RoME::TA wd=tempdir() year = 2007 suffix= "2020-03-05_time_h17m44s55" check_stratum_code(TA,year,Strata=RoME::stratification_scheme,wd,suffix)
Check if the sub-sample is smaller than the 10 percent of the total weight in the haul.
check_subsampling(ResultTC,year,wd,suffix)check_subsampling(ResultTC,year,wd,suffix)
ResultTC |
Biological data table (TC). |
year |
reference year for the analysis. |
wd |
Working directory selected by the user. |
suffix |
Suffix string of the Logfile. |
This function give a warning, reported in the Logfile, if the sub-sample is unusually small respect to the total catch of the species.
The function returns always TRUE, because the outcome of the function is a warning that does not lock the execution of the 'RoME' checks. The presence of inconsistencies in the data is reported in the logfile stored in the "Logfiles" subdirectory of the "wd" user-defined directory.
I. Bitetto, W. Zupa
For the definition of the strata, please refer to: Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
TC = RoME::TC year=2007 wd=tempdir() suffix= "2020-03-05_time_h17m44s55" check_subsampling(TC,year,wd,suffix)TC = RoME::TC year=2007 wd=tempdir() suffix= "2020-03-05_time_h17m44s55" check_subsampling(TC,year,wd,suffix)
Performs data validation and swept area calculation for MEDITS TA-format data. The function verifies numeric consistency in key columns, computes mean depth and swept area, logs any detected issues, and generates a plot of swept area versus mean depth for visual inspection.
check_swept_area(ResultDataTA, year, wd, suffix)check_swept_area(ResultDataTA, year, wd, suffix)
ResultDataTA |
A data.frame containing MEDITS hauls data in TA-format. The function uses the following columns: |
year |
Numeric scalar. The year to be checked in the dataset. |
wd |
Character string. Path to the working directory where log files and plots will be saved. |
suffix |
Character string. Optional suffix to append to the output filenames. If NULL, a timestamp-based suffix is automatically generated. |
This function performs multiple validation steps on TA-format data for MEDITS hauls. It verifies that certain key columns contain numeric values and checks for missing or empty entries in critical fields such as WING_OPENING and DISTANCE.
For each haul, it calculates the mean depth as the average of SHOOTING_DEPTH and HAULING_DEPTH, and estimates the swept area in square kilometers using the formula . Any inconsistencies or errors encountered during these checks are written to a logfile stored in the Logfiles folder.
If the data contains valid entries, the function generates and saves a scatter plot showing the swept area against mean depth. The plot includes a background shading to visually separate the depth range 0-200 meters from deeper strata, assisting in the interpretation of data distribution across depth zones.
All output files are organized within subfolders named Logfiles and Graphs under the specified working directory.
A logical value:
TRUE if no errors were detected in the data.
FALSE if at least one error was found and logged.
W. Zupa
# Define working directory wd <- tempdir() # Load data ResultDataTA <- RoME::TA # Filter for specific area if needed ResultDataTA <- ResultDataTA[ResultDataTA$AREA == 18, ] # Run the check for year 2005 check_swept_area(ResultDataTA, year = 2005, wd = wd, suffix = NULL)# Define working directory wd <- tempdir() # Load data ResultDataTA <- RoME::TA # Filter for specific area if needed ResultDataTA <- ResultDataTA[ResultDataTA$AREA == 18, ] # Run the check for year 2005 check_swept_area(ResultDataTA, year = 2005, wd = wd, suffix = NULL)
Check if the individuals by species, length, sex and maturity stage reported in TE are less than the number reported in TC
check_TE_TC(ResultDataTC,ResultDataTE,year,wd,suffix)check_TE_TC(ResultDataTC,ResultDataTE,year,wd,suffix)
ResultDataTC |
Biological data table(TC). |
ResultDataTE |
Individual data table (TE). |
year |
reference year for the analysis. |
wd |
Working directory selected by the user. |
suffix |
Suffix string of the Logfile. |
This function gives an error message, thus the execution is stopped if in TE are reported individuals not present in TC and if the number of individuals reported in TE is greater than the ones in TE; the user is informed in the Logfile.
The function returns TRUE if there is no error, while FALSE if there is one or more errors.The run, in case of error, thus, is stopped.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd=tempdir() suffix= "2020-03-05_time_h17m44s55" tc <- RoME::TC te <- RoME::TE year=2012 check_TE_TC(tc,te,year,wd,suffix)wd=tempdir() suffix= "2020-03-05_time_h17m44s55" tc <- RoME::TC te <- RoME::TE year=2012 check_TE_TC(tc,te,year,wd,suffix)
This function checks if the temperature by haul is in the range 10-30 Celsius degrees; moreover, a plot depth versus temperature is produced and stored in the Graph folder.
check_temperature(ResultDataTA,year,wd,suffix)check_temperature(ResultDataTA,year,wd,suffix)
ResultDataTA |
Haul data table according to MEDITS protocol (TA). |
year |
reference year for the analysis. |
wd |
Working directory selected by the user. |
suffix |
Suffix string of the Logfile. |
This check uses the temperature range 10-30 Celsius degrees to provide quantitative warning and a plot, automatically stored in Graphs, for a qualitative inspection of that temperature data respect to depth.
The function returns always TRUE, because the outcome of the function is a warning that does not lock the execution of the 'RoME' checks. The presence of inconsistencies in the data is reported in the logfile stored in the "Logfiles" subdirectory of the "wd" user-defined directory.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
TA = RoME::TA year=2012 wd=tempdir() suffix="2020-03-05_time_h17m44s55" check_temperature(TA,year,wd,suffix)TA = RoME::TA year=2012 wd=tempdir() suffix="2020-03-05_time_h17m44s55" check_temperature(TA,year,wd,suffix)
The function checks if the correct value for TYPE_OF_FILE field is reported in each data table. This is a global function that runs with the data frames not filtered by year.
check_type(TA, TB, TC, TE, TL, years, wd, Errors)check_type(TA, TB, TC, TE, TL, years, wd, Errors)
TA |
Haul data table according to MEDITS protocol (TA) |
TB |
Catch data table according to MEDITS protocol (TB) |
TC |
Biological data table according to MEDITS protocol (TC) |
TE |
Individual biological data table according to MEDITS protocol (TE) |
TL |
Litter data table according to MEDITS protocol (TL) |
years |
list of the unique YEAR values in haul data (TA) table |
wd |
working directory path defined by the user |
Errors |
logfile name |
TA, TB and TC tables are mandatory while TE and TL could be used where available (otherwise use NA value).
The function returns FALSE when errors are detected in the TYPE_OF_FILE field of the data tables.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() TL = NA years <- unique(RoME::TA$YEAR) Errors <- file.path(wd,"Logfiles","Logfile.dat") check_type(TA=RoME::TA,TB=RoME::TB,TC=RoME::TC, TE=NA,TL=NA,years=years,wd=wd,Errors=Errors)wd <- tempdir() TL = NA years <- unique(RoME::TA$YEAR) Errors <- file.path(wd,"Logfiles","Logfile.dat") check_type(TA=RoME::TA,TB=RoME::TB,TC=RoME::TC, TE=NA,TL=NA,years=years,wd=wd,Errors=Errors)
Check the presence of unique valid haul codes.
check_unique_valid_haul(ResultDataTA,year,wd,suffix)check_unique_valid_haul(ResultDataTA,year,wd,suffix)
ResultDataTA |
Haul data table according to MEDITS protocol (TA). |
year |
reference year for the analysis. |
wd |
Working directory selected by the user. |
suffix |
Suffix string of the Logfile. |
This function produce an error, stopping the check procedure to avoid cascade errors.
The function returns TRUE if no error occurs, while FALSE is returned when there is more than one valid hauls. In the logfile is reported the list of all the records in which the inconsistency is detected.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
TA = RoME::TA year=2012 wd=tempdir() suffix= "2020-03-05_time_h17m44s55" check_unique_valid_haul(TA,year,wd,suffix)TA = RoME::TA year=2012 wd=tempdir() suffix= "2020-03-05_time_h17m44s55" check_unique_valid_haul(TA,year,wd,suffix)
This function performs quality checks on the consistency between the total weight and the total number of individuals recorded in the MEDITS TB table. The consistency check is carried out both quantitatively-using known reference ranges of mean weights for each species-and qualitatively-via plots displaying the observed mean weights for each species across hauls.
check_weight(ResultDataTB, year, DataTargetSpecies, wd, suffix)check_weight(ResultDataTB, year, DataTargetSpecies, wd, suffix)
ResultDataTB |
Catch data table formatted according to the MEDITS protocol (table TB). This data includes information on species, number of individuals, and total weight per haul. |
year |
Reference year for the analysis. Only hauls from the specified year will be analysed. |
DataTargetSpecies |
Table providing reference weight ranges for species. It contains the lower (5th percentile) and upper (95th percentile) bounds for the mean weight of individuals per species, based on historical data collected from 2012 to 2022 across all surveyed GSAs. This table should be kept updated to reflect the latest knowledge about species biology in the Mediterranean Sea. |
wd |
Working directory chosen by the user. This directory will contain subfolders where logs and plots will be saved. |
suffix |
Suffix string appended to the filenames of the log files. Useful for distinguishing outputs from multiple runs. |
The function operates in two phases:
1. Quantitative Check:
For each record in the TB table, the mean individual weight is computed.
If the species is listed in DataTargetSpecies, the mean weight is compared to its 5th-95th percentile reference range.
If the mean weight falls outside this interval, a record is saved in a CSV file reporting:
GSA
Year
Species
Haul number
Observed mean weight
Reference minimum (5th percentile)
Reference maximum (95th percentile)
Type of file
2. Qualitative Check (Plots):
For all species present in the dataset, the function generates plots of mean weight by haul, to visually check for possible outliers or abnormal variability.
To avoid excessive plotting, only species with at least 5 observations are plotted.
Plots display the mean weight for each haul, with haul numbers shown as labels.
If many species qualify for plotting, the function automatically splits the plots into multiple pages, each saved as a separate JPEG file. Each JPEG file contains up to 6 plots.
Files Produced:
Logfile (.dat): Contains a short message summarising whether any outliers were detected. Detailed warnings are no longer written here but are instead stored in the CSV file.
CSV File: Named as Check_Mean_Weights_Logfile_GSA<AREA>_Year<YEAR>_<suffix>.csv. Contains all observations where the mean weight falls outside the expected reference range.
Plots: Saved in JPEG format in the Graphs subdirectory. Filenames include GSA, year, and a page number.
This function always returns TRUE. The purpose of the function is to perform checks and report inconsistencies, but it does not interrupt the execution of other routines in the RoME package.
W. Zupa, I. Bitetto
Anonymous. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
TB <- RoME::TB year <- 2012 wd <- tempdir() suffix <- "2020-03-05_time_h17m44s55" check_weight(TB, year, DataTargetSpecies, wd, suffix)TB <- RoME::TB year <- 2012 wd <- tempdir() suffix <- "2020-03-05_time_h17m44s55" check_weight(TB, year, DataTargetSpecies, wd, suffix)
If total weight is different from 0, total number must be different from 0 (only if the category of the species is different from "E") and vice versa (for all faunistic categories).
check_weight_tot_nb(ResultDataTB,year,wd,suffix)check_weight_tot_nb(ResultDataTB,year,wd,suffix)
ResultDataTB |
Catch data table according to MEDITS protocol (TB) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
In this check 'RoME' verifies if for the records with total weight not null, there is a total number not null, except for categories V, G, H, D and E, as reported in MEDITS manual.
The function returns always TRUE, because the outcome of the function is a warning that does not lock the execution of the 'RoME' checks.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd=tempdir() year=2012 TB = RoME::TB suffix= "2020-03-05_time_h17m44s55" check_weight_tot_nb(TB,year,wd,suffix)wd=tempdir() year=2012 TB = RoME::TB suffix= "2020-03-05_time_h17m44s55" check_weight_tot_nb(TB,year,wd,suffix)
The function check if the correct value for YEAR field is reported in each data table. This is a global function that runs with the data frames not filtered by year.
check_year(TA, TB, TC, TE, TL, years, wd, Errors)check_year(TA, TB, TC, TE, TL, years, wd, Errors)
TA |
Haul data table according to MEDITS protocol (TA) |
TB |
Catch data table according to MEDITS protocol (TB) |
TC |
Biological data table according to MEDITS protocol (TC) |
TE |
Individual biological data table according to MEDITS protocol (TE) |
TL |
Litter data table according to MEDITS protocol (TL) |
years |
list of the unique YEAR values in haul data (TA) table |
wd |
working directory path defined by the user |
Errors |
logfile name |
TA, TB and TC tables are mandatory while TE and TL could be used where available (otherwise use NA value).
The function returns FALSE when errors are detected in the YEAR field of the data tables.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() years <- unique(RoME::TA$YEAR) Errors <- file.path(wd,"Logfiles","Logfile.dat") check_year(TA=RoME::TA, TB=RoME::TB, TC=RoME::TC, TE=NA, TL=NA, years=years, wd=wd, Errors=Errors)wd <- tempdir() years <- unique(RoME::TA$YEAR) Errors <- file.path(wd,"Logfiles","Logfile.dat") check_year(TA=RoME::TA, TB=RoME::TB, TC=RoME::TC, TE=NA, TL=NA, years=years, wd=wd, Errors=Errors)
Function to check the correctness of the headers for haul data (TA), catch data (TB), biological data (TC), individual data (TE), litter data (TL) tables.
checkHeader(dataframe, template,wd,suffix)checkHeader(dataframe, template,wd,suffix)
dataframe |
Table to check |
template |
Template used for the check. |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
This function produce an error, stopping the check procedure to avoid cascade errors.
The function returns TRUE if no error occurs, while FALSE is returned when there is more than one valid hauls. In the logfile and in the console is reported the list of all the records in which the inconsistency is detected.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd=tempdir() suffix= "2020-03-05_time_h17m44s55" checkHeader(RoME::TA,"TA",wd,suffix) checkHeader(RoME::TB,"TB",wd,suffix) checkHeader(RoME::TC,"TC",wd,suffix)wd=tempdir() suffix= "2020-03-05_time_h17m44s55" checkHeader(RoME::TA,"TA",wd,suffix) checkHeader(RoME::TB,"TB",wd,suffix) checkHeader(RoME::TC,"TC",wd,suffix)
Definition of field' classes for TX tables
data("classes")data("classes")
A data frame with 123 observations on the following 4 variables.
RDBFISa character vector
MEDITSa character vector
tablea character vector
typea character vector
See Medits handbook.
W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
data(classes)data(classes)
This function report the information contained in the biological data table (TB) from the MEDITS protocol to the format required by R-sufi (Rochet et al., 2004).
create_catch(ResultDataTB,year,wd,save=TRUE)create_catch(ResultDataTB,year,wd,save=TRUE)
ResultDataTB |
Catch data table according to MEDITS protocol (TB) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
save |
boolean value to save the results in a csv file |
The function saves by default in the files R-Sufi folder the table capt in.csv format, with suffix of the year and GSA. If save parameter is FALSE the function returns the data frame as output.
I. Bitetto, W. Zupa
Rochet M. J., V. M. Trenkel, J. A. Bertrand & J.-C. Poulard, 2004. R routines for survey based fisheries population and community indicators (R-SUFI). Ifremer, Nantes. Limited distribution. Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
TB = RoME::TB year =2012 wd = tempdir() create_catch(TB,year,wd,save=TRUE)TB = RoME::TB year =2012 wd = tempdir() create_catch(TB,year,wd,save=TRUE)
This function reports the information contained in the haul data table (TA) from the MEDITS protocol to the format required by R-sufi (Rochet et al., 2004).
create_haul(ResultDataTA,year,wd,save=TRUE)create_haul(ResultDataTA,year,wd,save=TRUE)
ResultDataTA |
Haul data table according to MEDITS protocol (TA) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
save |
boolean value to save the results in a csv file |
The function saves by default in the files R-Sufi folder the table traits in.csv format, with suffix of the year and GSA. If save parameter is FALSE the function returns the data frame as output.
I. Bitetto, W. Zupa
Rochet M. J., V. M. Trenkel, J. A. Bertrand & J.-C. Poulard, 2004. R routines for survey based fisheries population and community indicators (R-SUFI). Ifremer, Nantes. Limited distribution. Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
TA = RoME::TA year = 2012 wd = tempdir() create_haul(TA,year,wd,save=FALSE)TA = RoME::TA year = 2012 wd = tempdir() create_haul(TA,year,wd,save=FALSE)
This function reports the information contained in the biological data table (TC) from the MEDITS protocol to the format required by R-sufi (Rochet et al., 2004).
create_length(ResultData,year,DataSpecies=RoME::TM_list,wd,save=TRUE)create_length(ResultData,year,DataSpecies=RoME::TM_list,wd,save=TRUE)
ResultData |
Biological data table according to MEDITS protocol (TC) |
year |
reference year for the analysis |
DataSpecies |
TM_list reference list |
wd |
working directory path defined by the user |
save |
boolean value to save the results in a csv file |
For the file taille the change in maturity scale in 2006 has been taken into account: from 1994 to 2005 the males of crustaceans have stage NA, because they were not staged until 2005. From 2006 they are considered mature for the stages strictly greater than 2A as well as for females of crustaceans. Before 2006 the females of crustaceans are considered mature for stages strictly greater than 1. Bony fish and cephalopods are considered mature from stage 3 until 2005 and then they are considered mature from stage 2B. For selachians, the immature are always stage 1 and 2.
The function saves by default in the files R-Sufi folder the table taille in.csv format, with suffix of the year and GSA. If save parameter is FALSE the function returns the data frame as output.
I. Bitetto, W. Zupa
Rochet M. J., V. M. Trenkel, J. A. Bertrand & J.-C. Poulard, 2004. R routines for survey based fisheries population and community indicators (R-SUFI). Ifremer, Nantes. Limited distribution. Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
ResultData = RoME::TC year=2012 DataSpecies=RoME::TM_list wd <- tempdir() create_length(ResultData,year,DataSpecies,wd,save=FALSE)ResultData = RoME::TC year=2012 DataSpecies=RoME::TM_list wd <- tempdir() create_length(ResultData,year,DataSpecies,wd,save=FALSE)
This function reports the information contained in the stratification scheme for the selected area from the MEDITS protocol to the format required by R-sufi (Rochet et al., 2004).
create_strata(Stratification,AREA,wd,save=TRUE)create_strata(Stratification,AREA,wd,save=TRUE)
Stratification |
Stratification scheme according to MEDITS protocol. |
AREA |
String of the GSA. |
wd |
Working directory selected by the user. |
save |
boolean value to save the results in a csv file |
The function saves automatically in the files R-Sufi folder the table strata in.csv format, with suffix of the year and GSA. If save parameter is FALSE the function returns the data frame as output.
I. Bitetto, W. Zupa
Rochet M. J., V. M. Trenkel, J. A. Bertrand & J.-C. Poulard, 2004. R routines for survey based fisheries population and community indicators (R-SUFI). Ifremer, Nantes. Limited distribution. Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
Stratification=RoME::stratification_scheme wd <- tempdir() AREA = 18 create_strata(Stratification,AREA,wd,save=TRUE)Stratification=RoME::stratification_scheme wd <- tempdir() AREA = 18 create_strata(Stratification,AREA,wd,save=TRUE)
Data frame containing information about length and individual weight ranges for relevant species, including quantiles and various statistics. It also contains metadata about faunistic category and period of relevance as target species.
data("DataTargetSpecies")data("DataTargetSpecies")
A data frame with 392 observations on the following 26 variables:
SPECIESRubincode species identifier (character).
WMINMinimum observed individual weight (numeric).
WMIN055th percentile of individual weight (numeric).
WMIN1010th percentile of individual weight (numeric).
WMIN2525th percentile of individual weight (numeric).
WMAX_7575th percentile of individual weight (numeric).
WMAX9090th percentile of individual weight (numeric).
WMAX9595th percentile of individual weight (numeric).
WMAXMaximum observed individual weight (numeric).
LMINMinimum observed length (numeric, in mm).
LMIN011st percentile of length (numeric, in mm).
LMIN055th percentile of length (numeric, in mm).
LMIN1010th percentile of length (numeric, in mm).
LMIN2525th percentile of length (numeric, in mm).
LMAX7575th percentile of length (numeric, in mm).
LMAN9090th percentile of length calculated via mean or other method (numeric, in mm).
LMAX9595th percentile of length (numeric, in mm).
LMAX9999th percentile of length (numeric, in mm).
LMAXMaximum observed length (numeric, in mm).
obs_in_TCNumber of observations found in TC data (numeric).
FAUNISTIC_CATEGORYOld faunistic categories (character).
START_YEARYear when the species started to be considered target (numeric).
END_YEARYear when the species stopped being considered target (numeric).
GROUPSpecies group or classification (character).
W. Zupa
Literature and other data sources.
data(DataTargetSpecies) head(DataTargetSpecies)data(DataTargetSpecies) head(DataTargetSpecies)
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) |
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 TA file should be populated with coordinates in decimal degrees format.
The function returns the vector of the distances expressed in the selected measure unit.
Walter Zupa
TA.dd <- MEDITS.to.dd(TA) dd.distance(TA.dd, unit="km", verbose=FALSE)TA.dd <- MEDITS.to.dd(TA) dd.distance(TA.dd, unit="km", verbose=FALSE)
Function generating the error summary table.
error.table(check.df,check_without_errors, check_without_warnings,checkName,table,Field,yea)error.table(check.df,check_without_errors, check_without_warnings,checkName,table,Field,yea)
check.df |
data frame of the checks |
check_without_errors |
boolean variable reporting if errors were detected |
check_without_warnings |
boolean variable reporting if warnings were detected |
checkName |
string of the check name |
table |
reference table checked by the function |
Field |
field checked by check dictionary |
yea |
reference year |
The function generate the summary table of the errors detected by the RoMEcc function.
The output of the function is the data frame check.df updated with the result of the check.
W. Zupa, I. Bitetto
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
Qualitative control (by means of 2 graphs) of relation between shooting depth e warp opening and between warp length e wing opening
graphs_TA(DataTA, year, wd, suffix)graphs_TA(DataTA, year, wd, suffix)
DataTA |
Haul data table according to MEDITS protocol (TA) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The function generate 2 graphs for qualitative controls.
Two graphs are stored in the Graphs folder in the wd user defined directory
W. Zupa, I. Bitetto
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
TA = RoME::TA year = 2012 wd <- tempdir() suffix="2020-03-05_time_h17m44s55" graphs_TA(RoME::TA,year,wd,suffix)TA = RoME::TA year = 2012 wd <- tempdir() suffix="2020-03-05_time_h17m44s55" graphs_TA(RoME::TA,year,wd,suffix)
GSAs table
data("GSAs")data("GSAs")
A data frame with 31 observations on the following 3 variables.
GSAa numeric vector
CODEa character vector
Areaa character vector
W. Zupa
https://www.fao.org/gfcm/data/maps/gsas/en/
https://www.fao.org/gfcm/data/maps/gsas/en/
data(GSAs) str(GSAs) head(GSAs)data(GSAs) str(GSAs) head(GSAs)
The function identify the hauls that don't fall in the user defined sea area.
haul_at_sea(DataTA,year,seas=RoME::MedSea,verbose = TRUE)haul_at_sea(DataTA,year,seas=RoME::MedSea,verbose = TRUE)
DataTA |
Haul data table according to MEDITS protocol (TA) |
year |
reference year for the analysis |
seas |
polygon shapefile defining the extension of the sea area. The default |
verbose |
boolean variable returning verbose output if TRUE |
The function check whether the haul position falls in the polygon seas defining the extension of the reference sea area.
The function returns the list of the hauls out of the seas polygon. In case only starting haul positions are out of the sea's area a data frame is returned. If both starting and end positions are out of the polygon an object of class list is returned.
W. Zupa, I. Bitetto
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
TA = RoME::TA year = 2012 wd <- tempdir() suffix="2020-03-05_time_h17m44s55" haul_at_sea(TA,year, seas = MedSea, verbose = TRUE)TA = RoME::TA year = 2012 wd <- tempdir() suffix="2020-03-05_time_h17m44s55" haul_at_sea(TA,year, seas = MedSea, verbose = TRUE)
Headers conversion for MEDITS tables
headers.conversion(table, type, verbose = FALSE)headers.conversion(table, type, verbose = FALSE)
table |
data frame of the TX table |
type |
type of tables to be analysed. Allowed values: "TA","TB","TC","TE","TL" |
verbose |
boolean. If TRUE a message is printed. |
The functions allow to convert headers of table coming from RDBFIS data base to the MEDITS format expected from RoME package
A data frame object is returned including the only allowed field
List of the target species G1 and G1 as defined by the MEDITS protocol (see MEDITS-Handbook Version 9 2017)
data("list_g1_g2")data("list_g1_g2")
A data frame with 88 observations on the following 17 variables.
Noa numeric vector of progressive number
Medit_LIST_proposal_2011a factor with levels of the list proposed in 2011
Species_group_DCFa factor with levels of the DCF species groups
MEDITS_G1a numeric vector of G1 species
MEDITS_G2a numeric vector of G2 species
Groupa factor with levels of groups
Old_MEDITS_lista numeric vectorof the old MEDITS list
Tot_NoTot_No
Tot_WTot_W
Ind_LengthInd_Length
Sexa factor with levels of sex
Mat_stagea factor with levels of maturity stages
Agea factor with levels of age
Ind_weighta factor with levels of Ind_weight
Datea factor with levels of Date
CODEa factor with levels CODE
English_common_namea factor with levels of common names in english language
W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
data(list_g1_g2)data(list_g1_g2)
Table of the length-weight relationship coefficients reported by species, area and sex.
data("LW")data("LW")
A data frame with 460 observations on the following 5 variables.
AREAvector of the reference geographic area
SPECIESreference species for the a and b parameters
SEXreference sex for the a and b parameters
aa parameters of the length-weight relationship function
bb parameters of the length-weight relationship function
Table of the length-weight relationship coefficients a and b.
W. Zupa
data(LW) str(LW)data(LW) str(LW)
Table of maturity stages
data("mat_stages")data("mat_stages")
A data frame with 132 observations on the following 4 variables.
TYPE_OF_FILEa character vector
FAUNISTIC_CATEGORYa character vector
SEXa character vector
MATURITYa character vector
MATSUBa character vector
codea character vector
Table of maturity stages per faunistic category.The maturity scales adopted up to 2006 is also provided.
W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
data(mat_stages) str(mat_stages)data(mat_stages) str(mat_stages)
Maturity parameters used for the checks: check_smallest_mature, check_spawning_period and check_sex_inversion
data("Maturity_parameters")data("Maturity_parameters")
A data frame with 64 observations on the following 12 variables.
Speciesa factor with levels the rubincodes of the species for which the information is known.
SEXa factor with levels C F M
min_L50a numeric vector
max_L50a numeric vector
smallest_mature_individual_observeda numeric vector
min_length_SEX_INVERSIONa numeric vector
max_length_SEX_INVERSIONa numeric vector
Type_of_hermaphroditisma factor with levels proterandrous protogynous
Areaa factor with levels as the area of the relevant information
Start_reproductive_seasona numeric vector
End_reproductive_seasona numeric vector
Referencea factor with levels of the bibliographic references
W. Zupa
Literature and others
data(Maturity_parameters)data(Maturity_parameters)
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.
Walter Zupa
MEDITS.to.dd(TA)MEDITS.to.dd(TA)
Polygon shapefile describing the GFCM's Geographical subareas (GSAs)
data("MedSea")data("MedSea")
The shapefile is derived from the GFCM's Geographical subareas (GSAs) shapefile
Polygon shapefile describing the GFCM's Geographical subareas (GSAs) compressed with the xz type of compression.
W. Zupa
https://www.fao.org/fileadmin/user_upload/faoweb/GFCM/Maps/GSAs_simplified.zip
https://www.fao.org/gfcm/data/maps/gsas/en/
library(sp) data(MedSea) plot(MedSea)library(sp) data(MedSea) plot(MedSea)
Management of the error in logfile.
printError(funname,check_without_errors, stop_)printError(funname,check_without_errors, stop_)
funname |
name of the check function. |
check_without_errors |
TRUE if there is no error, FALSE if there is any error. |
stop_ |
TRUE if the 'RoME' function has to stop, FALSE if the run should continue |
The function updates the 'stop_' value and returns it as a logical value.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
printError("check_abundance", FALSE, FALSE)printError("check_abundance", FALSE, FALSE)
Management of the error in logfile.
printError_cc(funname,check_without_errors, stop_)printError_cc(funname,check_without_errors, stop_)
funname |
name of the check function. |
check_without_errors |
TRUE if there is no error, FALSE if there is any error. |
stop_ |
TRUE if the 'RoME' function has to stop, FALSE if the run should continue |
The function updates the 'stop_' value and returns it as a logical value.
W. Zupa, I. Bitetto
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
printError_cc("check_abundance", FALSE, FALSE)printError_cc("check_abundance", FALSE, FALSE)
The function calls all the functions built in the package in an ordered way to perform a complete quality check of TX data available. The check is performed simultaneously on the files that can contain also data of more than one year.
RoME(TA,TB,TC,TE=NA,TL=NA,wd,suffix=NA, create_RSufi_files = FALSE, create_global_RSufi_files=FALSE, Year_start=NA,Year_end=NA,verbose =TRUE,Stratification=RoME::stratification_scheme, Ref_list=RoME::TM_list,DataTargetSpecies=RoME::DataTargetSpecies, Maturity=RoME::Maturity_parameters, ab_parameters=RoME::LW, stages_list=RoME::mat_stages,assTL=assTL)RoME(TA,TB,TC,TE=NA,TL=NA,wd,suffix=NA, create_RSufi_files = FALSE, create_global_RSufi_files=FALSE, Year_start=NA,Year_end=NA,verbose =TRUE,Stratification=RoME::stratification_scheme, Ref_list=RoME::TM_list,DataTargetSpecies=RoME::DataTargetSpecies, Maturity=RoME::Maturity_parameters, ab_parameters=RoME::LW, stages_list=RoME::mat_stages,assTL=assTL)
TA |
Haul data table according to MEDITS protocol (TA) |
TB |
Catch data table according to MEDITS protocol (TB) |
TC |
Biological data table according to MEDITS protocol (TC) |
TE |
Individual biological data table according to MEDITS protocol (TE) if available, if TE data are not available, use NA. |
TL |
Litter data table according to MEDITS protocol (TL) if available, if TL data are not available, use NA |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile, in case it |
create_RSufi_files |
boolean variables used to choose if create R-sufi files. The files are saved in the R-sufi directory and named with a suffix of the year and GSA |
create_global_RSufi_files |
boolean variables used to choose if global R-sufi files should be created from an year to another year |
Year_start |
numeric value indicating the starting year for the production of R-sufi file. This parameter must to be reported in case |
Year_end |
numeric value indicating the ending year for the production of R-sufi files |
verbose |
... |
Stratification |
Stratification scheme according to MEDITS protocol. |
Ref_list |
TM_list reference list |
DataTargetSpecies |
Information related to target species. |
Maturity |
Information related to sex and maturity from literature or other sources. |
ab_parameters |
dataframe containing the a and b parameters of the length-weight relationships |
stages_list |
Table of maturity stages. |
assTL |
data frame with the association between TL (litter table) categories and sub-categories |
RoME checks can be used to integrate a list of common quality checks on survey data. This function calls all the functions built in the package in an ordered way to perform a complete quality check of TX data available. The order of the checks in RoME was implemented in a defined sequence to avoid cascade errors due to the correction of a previous error. No automatic correction is implemented in 'RoME'. 'RoME' stops if an error occurs; then the user has to correct the error and run again the code to continue with the other checks. The function runs on a complete time series dataset, checking year after year, until the end of the time series. After the checks of the mandatory fields and the controlled vocabulary, that are carried out for all the TX tables, the specific checks on each kind of TX table are performed. Finally, RoME provides a list of cross checks aimed to guarantee the consistency among the data tables.
Some functions included in the 'RoME' library and used by RoME function need specific dictionaries or tables. It is the case of Stratification, Ref_list, DataTargetSpecies, Maturity_parameters, mat_stages and assTL tables. All of them are provided by default in this library. Anyway, the user has the possibility to provide ad hoc modified versions of these tables adapting the checks to specific needs.
The function does not correct data, but it detects the errors, warning the user that there is the possibility of one or more errors, specifying the type of the error and easing the data correction. If parameter verbose=TRUE returns a series of text output in console to let the user to trace the state of the checks. All the output of the functions are stored in the user defined working directory wd and in the sub-directory there resident. In the Lofile subfolder are stored the logfiles of each run of the function.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix=NA DataTA = RoME::TA DataTB = RoME::TB DataTC = RoME::TC DataTE = NA DataTL = NA RoME(DataTA, DataTB,DataTC,DataTE,DataTL, wd, suffix, Stratification=RoME::stratification_scheme, Ref_list=RoME::TM_list,DataTargetSpecies=RoME::DataTargetSpecies, Maturity=RoME::Maturity_parameters,ab_parameters=RoME::LW, stages_list=RoME::mat_stages,assTL=RoME::assTL)wd <- tempdir() suffix=NA DataTA = RoME::TA DataTB = RoME::TB DataTC = RoME::TC DataTE = NA DataTL = NA RoME(DataTA, DataTB,DataTC,DataTE,DataTL, wd, suffix, Stratification=RoME::stratification_scheme, Ref_list=RoME::TM_list,DataTargetSpecies=RoME::DataTargetSpecies, Maturity=RoME::Maturity_parameters,ab_parameters=RoME::LW, stages_list=RoME::mat_stages,assTL=RoME::assTL)
The function RoMEBScc performs a full suite of automated, non-stopping quality checks on survey data for the Black Sea. It invokes the same sequence of validation routines as RoMEcc (for TA, TB, TC, TE and TL tables) but uses tables and parameters tailored to Black Sea strata, species and maturity references.
RoMEBScc( TA, TB, TC, TE = NA, TL = NA, wd, suffix = NA, verbose = TRUE, Stratification = RoME::stratification_scheme, Ref_list = RoME::TM_list, DataTargetSpecies = RoME::DataTargetSpecies, Maturity = RoME::Maturity_parameters, ab_parameters = RoME::LW, stages_list = RoME::mat_stages, assTL = RoME::assTL, zip = TRUE )RoMEBScc( TA, TB, TC, TE = NA, TL = NA, wd, suffix = NA, verbose = TRUE, Stratification = RoME::stratification_scheme, Ref_list = RoME::TM_list, DataTargetSpecies = RoME::DataTargetSpecies, Maturity = RoME::Maturity_parameters, ab_parameters = RoME::LW, stages_list = RoME::mat_stages, assTL = RoME::assTL, zip = TRUE )
TA |
Haul metadata table (TA) |
TB |
Catch data table (TB) |
TC |
Biological data table (TC) |
TE |
Individual biological data table (TE), or |
TL |
Litter table (TL), or |
wd |
Working directory path where "Logfiles" and "Graphs" subfolders are written. |
suffix |
Character suffix for output filenames. If |
verbose |
Logical; if |
Stratification |
Stratification scheme object; defaults to |
Ref_list |
Reference list for tow metadata; defaults to |
DataTargetSpecies |
Species-specific reference dataset; defaults to |
Maturity |
Maturity-parameter table; defaults to |
ab_parameters |
Length-weight parameter table; defaults to |
stages_list |
Maturity-stage lookup table; defaults to |
assTL |
Category-subcategory mapping for TL; defaults to |
zip |
Logical; if |
RoMEBScc checks can be used to integrate a list of common quality checks on survey datafrom Black Sea. This function calls all the functions built in the package in an ordered way to perform a complete quality check of TX data available. The order of the checks in RoME was implemented in a defined sequence to avoid cascade errors due to the correction of a previous error. No automatic correction is implemented in 'RoME'. 'RoME' stops if an error occurs; then the user has to correct the error and run again the code to continue with the other checks. The function runs on a complete time series dataset, checking year after year, until the end of the time series. After the checks of the mandatory fields and the controlled vocabulary, that are carried out for all the TX tables, the specific checks on each kind of TX table are performed. Finally, RoME provides a list of cross checks aimed to guarantee the consistency among the data tables.
Some functions included in the 'RoME' library and used by RoME function need specific dictionaries or tables. It is the case of Stratification, TM_list, DataTargetSpecies, Maturity_parameters, mat_stages and assTL tables. All of them are provided by default in this library. Anyway, the user has the possibility to provide ad hoc modified versions of these tables adapting the checks to specific needs.
The function does not correct data, but it detects the errors, warning the user that there is the possibility of one or more errors, specifying the type of the error and easing the data correction. If parameter verbose=TRUE returns a series of text output in console to let the user to trace the state of the checks. All the output of the functions are stored in the user defined working directory wd and in the sub-directory there resident. In the Lofile subfolder are stored the logfiles of each run of the function.
W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() # Example using TA, TB, TC slices for 2018 TA_sub <- RoME::TA[RoME::TA$YEAR == 2018, ] TB_sub <- RoME::TB[RoME::TB$YEAR == 2018, ] TC_sub <- RoME::TC[RoME::TC$YEAR == 2018, ] # TE/TL not used in this example RoMEBScc( TA_sub, TB_sub, TC_sub, TE = NA, TL = NA, wd = wd, suffix = "BS_test", verbose = FALSE )wd <- tempdir() # Example using TA, TB, TC slices for 2018 TA_sub <- RoME::TA[RoME::TA$YEAR == 2018, ] TB_sub <- RoME::TB[RoME::TB$YEAR == 2018, ] TC_sub <- RoME::TC[RoME::TC$YEAR == 2018, ] # TE/TL not used in this example RoMEBScc( TA_sub, TB_sub, TC_sub, TE = NA, TL = NA, wd = wd, suffix = "BS_test", verbose = FALSE )
The function calls all the functions included in the package in an ordered way to perform a complete quality check of TX data available. The check is performed simultaneously on the files that can contain also data of more than one year. Unlike the RoME function, RoMEcc does not stop at the first detected error, allowing user to correct data. Instead, it checks all the data and returns a report on the errors found, as well as compiling a detailed log file.
RoMEcc(TA,TB,TC,TE=NA,TL=NA,wd,suffix=NA, verbose =TRUE,Stratification=RoME::stratification_scheme, Ref_list=RoME::TM_list,DataTargetSpecies=RoME::DataTargetSpecies, Maturity=RoME::Maturity_parameters, ab_parameters=RoME::LW, stages_list=RoME::mat_stages,assTL=RoME::assTL, zip=TRUE)RoMEcc(TA,TB,TC,TE=NA,TL=NA,wd,suffix=NA, verbose =TRUE,Stratification=RoME::stratification_scheme, Ref_list=RoME::TM_list,DataTargetSpecies=RoME::DataTargetSpecies, Maturity=RoME::Maturity_parameters, ab_parameters=RoME::LW, stages_list=RoME::mat_stages,assTL=RoME::assTL, zip=TRUE)
TA |
Haul data table according to MEDITS protocol (TA) |
TB |
Catch data table according to MEDITS protocol (TB) |
TC |
Biological data table according to MEDITS protocol (TC) |
TE |
Individual biological data table according to MEDITS protocol (TE) if available, if TE data are not available, use NA. |
TL |
Litter data table according to MEDITS protocol (TL) if available, if TL data are not available, use NA |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile, in case it |
verbose |
... |
Stratification |
Stratification scheme according to MEDITS protocol. |
Ref_list |
TM_list reference list |
DataTargetSpecies |
Information related to target species. |
Maturity |
Information related to sex and maturity from literature or other sources. |
ab_parameters |
dataframe containing the a and b parameters of the length-weight relationships |
stages_list |
Table of maturity stages. |
assTL |
data frame with the association between TL (litter table) categories and sub-categories |
zip |
boolean, if TRUE a zip file containing the results is generated |
RoMEcc checks can be used to integrate a list of common quality checks on survey data. This function calls all the functions built in the package in an ordered way to perform a complete quality check of TX data available. The order of the checks in RoME was implemented in a defined sequence to avoid cascade errors due to the correction of a previous error. No automatic correction is implemented in 'RoME'. 'RoME' stops if an error occurs; then the user has to correct the error and run again the code to continue with the other checks. The function runs on a complete time series dataset, checking year after year, until the end of the time series. After the checks of the mandatory fields and the controlled vocabulary, that are carried out for all the TX tables, the specific checks on each kind of TX table are performed. Finally, RoME provides a list of cross checks aimed to guarantee the consistency among the data tables.
Some functions included in the 'RoME' library and used by RoME function need specific dictionaries or tables. It is the case of Stratification, TM_list, DataTargetSpecies, Maturity_parameters, mat_stages and assTL tables. All of them are provided by default in this library. Anyway, the user has the possibility to provide ad hoc modified versions of these tables adapting the checks to specific needs.
The function does not correct data, but it detects the errors, warning the user that there is the possibility of one or more errors, specifying the type of the error and easing the data correction. If parameter verbose=TRUE returns a series of text output in console to let the user to trace the state of the checks. All the output of the functions are stored in the user defined working directory wd and in the sub-directory there resident. In the Lofile subfolder are stored the logfiles of each run of the function.
W. Zupa,I. Bitetto
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix=NA DataTA = data.frame(RoME::TA[RoME::TA$YEAR==2012 ,]) DataTB = data.frame(RoME::TB[RoME::TB$YEAR==2012 ,]) DataTC = data.frame(RoME::TC[RoME::TC$YEAR==2012 ,]) DataTE = NA DataTL = NA RoMEcc(DataTA, DataTB,DataTC,DataTE,DataTL, wd, suffix, Stratification=RoME::stratification_scheme, Ref_list=RoME::TM_list,DataTargetSpecies=RoME::DataTargetSpecies, Maturity=RoME::Maturity_parameters,ab_parameters=RoME::LW, stages_list=RoME::mat_stages,assTL=RoME::assTL, verbose=FALSE)wd <- tempdir() suffix=NA DataTA = data.frame(RoME::TA[RoME::TA$YEAR==2012 ,]) DataTB = data.frame(RoME::TB[RoME::TB$YEAR==2012 ,]) DataTC = data.frame(RoME::TC[RoME::TC$YEAR==2012 ,]) DataTE = NA DataTL = NA RoMEcc(DataTA, DataTB,DataTC,DataTE,DataTL, wd, suffix, Stratification=RoME::stratification_scheme, Ref_list=RoME::TM_list,DataTargetSpecies=RoME::DataTargetSpecies, Maturity=RoME::Maturity_parameters,ab_parameters=RoME::LW, stages_list=RoME::mat_stages,assTL=RoME::assTL, verbose=FALSE)
When the check procedure is completed for a number of years, it is possible to obtain the 4 R-Sufi global files from an year to another year.
RSufi_files(Year_start,Year_end,AREA,wd)RSufi_files(Year_start,Year_end,AREA,wd)
Year_start |
Start year |
Year_end |
Start end |
AREA |
String of the GSA. Include only the number. |
wd |
working directory path defined by the user |
The function saves automatically in the files R-Sufi folder the 4 global files, with suffix of the year range and GSA.
I. Bitetto, W. Zupa
Rochet M. J., V. M. Trenkel, J. A. Bertrand & J.-C. Poulard, 2004. R routines for survey based fisheries population and community indicators (R-SUFI). Ifremer, Nantes. Limited distribution. Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
TA = RoME::TA TB = RoME::TB TC = RoME::TC DataSpecies=RoME::TM_list Stratification=RoME::stratification_scheme year = 2012 wd <- tempdir() create_haul(TA,year,wd,save=TRUE) create_catch(TB,year,wd,save=TRUE) create_length(TC,year,DataSpecies,wd,save=TRUE) create_strata(Stratification,"10",wd,save=TRUE) RSufi_files(2012,2012,"10",wd) # run only if you are working outside a temporary directoryTA = RoME::TA TB = RoME::TB TC = RoME::TC DataSpecies=RoME::TM_list Stratification=RoME::stratification_scheme year = 2012 wd <- tempdir() create_haul(TA,year,wd,save=TRUE) create_catch(TB,year,wd,save=TRUE) create_length(TC,year,DataSpecies,wd,save=TRUE) create_strata(Stratification,"10",wd,save=TRUE) RSufi_files(2012,2012,"10",wd) # run only if you are working outside a temporary directory
Launches the embedded Shiny application included in the package.
run_RoME_app()run_RoME_app()
No return value, called for side effects
Check for summarize the individual data collection (goodness of individual data sampling)
scheme_individual_data(DataTC, DataTE, year, wd, suffix)scheme_individual_data(DataTC, DataTE, year, wd, suffix)
DataTC |
Biological data table according to MEDITS protocol (TC) |
DataTE |
Individual biological data table according to MEDITS protocol (TE) |
year |
reference year for the analysis |
wd |
working directory path defined by the user |
suffix |
Suffix string of the Logfile |
The function uses biological data and individual biological data to produce a table where for each species are stored the number of length measurements, individual weights and number of otoliths taken by length class.
This check has as output a table (automatically saved in the wd user defined directory) named sampling_individual_measures.csv where for each species are stored the number of length measurements, individual weights and number of otoliths taken by length class. This table is useful to the user to evaluate the coverage of the individual measurements collections in order to verify if the sampling is in line with the protocol and to understand how eventually improve the sampling procedure.
I. Bitetto, W. Zupa
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTC = RoME::TC DataTE = RoME::TE year=2012 scheme_individual_data(DataTC,DataTE,year, wd, suffix)wd <- tempdir() suffix="2020-03-05_time_h17m44s55" DataTC = RoME::TC DataTE = RoME::TE year=2012 scheme_individual_data(DataTC,DataTE,year, wd, suffix)
Data frame of the stratification scheme specifically used in Romania and Bulgaria in the rapa whelk beam trawl survey.
W. Zupa
Dataframe containing the headers of TA, according to the MEDITS manual.
data("templateTA")data("templateTA")
A data frame with 0 observations on the following 43 variables.
TYPE_OF_FILEa logical vector
COUNTRYa logical vector
AREAa logical vector
VESSELa logical vector
GEARa logical vector
RIGGINGa logical vector
DOORSa logical vector
YEARa logical vector
MONTHa logical vector
DAYa logical vector
HAUL_NUMBERa logical vector
CODEND_CLOSINGa logical vector
PART_OF_THE_CODENDa logical vector
SHOOTING_TIMEa logical vector
SHOOTING_QUADRANTa logical vector
SHOOTING_LATITUDEa logical vector
SHOOTING_LONGITUDEa logical vector
SHOOTING_DEPTHa logical vector
HAULING_TIMEa logical vector
HAULING_QUADRANTa logical vector
HAULING_LATITUDEa logical vector
HAULING_LONGITUDEa logical vector
HAULING_DEPTHa logical vector
HAUL_DURATIONa logical vector
VALIDITYa logical vector
COURSEa logical vector
RECORDED_SPECIESa logical vector
DISTANCEa logical vector
VERTICAL_OPENINGa logical vector
WING_OPENINGa logical vector
GEOMETRICAL_PRECISIONa logical vector
BRIDLES_LENGTHa logical vector
WARP_LENGTHa logical vector
WARP_DIAMETERa logical vector
HYDROLOGICAL_STATIONa logical vector
OBSERVATIONSa logical vector
BOTTOM_TEMPERATURE_BEGINNINGa logical vector
BOTTOM_TEMPERATURE_ENDa logical vector
MEASURING_SYSTEMa logical vector
NUMBER_OF_THE_STRATUMa logical vector
BOTTOM_SALINITY_BEGINNINGa logical vector
BOTTOM_SALINITY_ENDa logical vector
MEASURING_SYSTEM_SALINITYa logical vector
See Medits handbook.
W. Zupa
The dataframe is empty and it is to be used to verify the correctness of headers.
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
data(templateTA)data(templateTA)
Dataframe containing the headers of TB, according to the MEDITS manual.
data("templateTB")data("templateTB")
A data frame with 0 observations on the following 43 variables.
TYPE_OF_FILEa logical vector
COUNTRYa logical vector
AREAa logical vector
VESSELa logical vector
YEARa logical vector
MONTHa logical vector
DAYa logical vector
HAUL_NUMBERa logical vector
CODEND_CLOSINGa logical vector
PART_OF_THE_CODENDa logical vector
FAUNISTIC_CATEGORYa logical vector
GENUSa logical vector
SPECIESa logical vector
NAME_OF_THE_REFERENCE_LISTa logical vector
TOTAL_WEIGHT_IN_THE_HAULa logical vector
TOTAL_NUMBER_IN_THE_HAULa logical vector
NB_OF_FEMALESa logical vector
NB_OF_MALESa logical vector
NB_OF_UNDETERMINEDa logical vector
See Medits handbook.
W. Zupa
The dataframe is empty and it is to be used to verify the correctness of headers.
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
data(templateTB)data(templateTB)
Dataframe containing the headers of TC, according to the MEDITS manual.
data("templateTC")data("templateTC")
A data frame with 0 observations on the following 43 variables.
TYPE_OF_FILEa logical vector
COUNTRYa logical vector
AREAa logical vector
VESSELa logical vector
YEARa logical vector
MONTHa logical vector
DAYa logical vector
HAUL_NUMBERa logical vector
CODEND_CLOSINGa logical vector
PART_OF_THE_CODENDa logical vector
FAUNISTIC_CATEGORYa logical vector
GENUSa logical vector
SPECIESa logical vector
LENGTH_CLASSES_CODEa logical vector
WEIGHT_OF_THE_FRACTIONa logical vector
WEIGHT_OF_THE_SAMPLE_MEASUREDa logical vector
SEXa logical vector
NO_OF_INDIVIDUAL_OF_THE_ABOVE_SEX_MEASUREDa logical vector
LENGTH_CLASSa logical vector
MATURITYa logical vector
MATSUBa logical vector
NUMBER_OF_INDIVIDUALS_IN_THE_LENGTH_CLASS_AND_MATURITY_STAGEa logical vector
See Medits handbook.
W. Zupa
The dataframe is empty and it is to be used to verify the correctness of headers.
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
data(templateTC)data(templateTC)
Dataframe containing the headers of TE, according to the MEDITS manual.
data("templateTE")data("templateTE")
A data frame with 0 observations on the following 43 variables.
TYPE_OF_FILEa logical vector
COUNTRYa logical vector
AREAa logical vector
VESSELa logical vector
YEARa logical vector
MONTHa logical vector
DAYa logical vector
HAUL_NUMBERa logical vector
FAUNISTIC_CATEGORYa logical vector
GENUSa logical vector
SPECIESa logical vector
LENGTH_CLASSES_CODEa logical vector
SEXa logical vector
NO_PER_SEX_MEASURED_IN_SUB_SAMPLE_FOR_OTOLITHa logical vector
LENGTH_CLASSa logical vector
MATURITYa logical vector
MATSUBa logical vector
INDIVIDUAL_WEIGHTa logical vector
NO_PER_SEX_MEASURED_IN_SUB_SAMPLE_FOR_WEIGHTa logical vector
OTOLITH_SAMPLEDa logical vector
NO_PER_SEX_MEASURED_IN_SUB_SAMPLE_FOR_AGEINGa logical vector
OTOLITH_READa logical vector
AGEa logical vector
OTOLITH_CODEa logical vector
RECORD_NUMBERa logical vector
See Medits handbook.
W. Zupa
The dataframe is empty and it is to be used to verify the correctness of headers.
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
data(templateTE)data(templateTE)
Template of the Litter data table (TL) as defined in the MEDITS protocol
data("templateTL")data("templateTL")
A data frame with 0 observations on the following 14 variables.
TYPE_OF_FILEa logical vector
COUNTRYa logical vector
AREAa logical vector
VESSELa logical vector
YEARa logical vector
MONTHa logical vector
DAYa logical vector
HAUL_NUMBERa logical vector
LITTER_CATEGORYa logical vector
a logical vector
TOTAL_WEIGHT_IN_THE_CATEGORY_HAULa logical vector
TOTAL_NUMBER_IN_THE_CATEGORY_HAULa logical vector
a logical vector
a logical vector
For details see MEDITS Survey - Instruction Manual - Version 9 (2017)
W. Zupa
MEDITS Survey - Instruction Manual - Version 9 (2017)
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
data(templateTL)data(templateTL)
allowed values for SHOOTING_TIME and HAULING_TIME
data("time")data("time")
A data frame with allowed values for SHOOTING_TIME and HAULING_TIME.
The integer values vector is used to check the correctness of SHOOTING_TIME and HAULING_TIME.
W. Zupa
Anonymus (2017) "MEDITS-Handbook. Version n. 9. MEDITS Working Group"
Anonymus (2017) "MEDITS-Handbook. Version n. 9. MEDITS Working Group"
data(time) str(time)data(time) str(time)
The present list is destined to code the marine species encountered in the Mediterranean. It has been built following the principle used in the Nordic Code Centre (Stockholm). For most of the species the codes are identical to those proposed by the NCC. However some species can be coded differently. In addition numerous Mediterranean species are not included in the NCC code and have been added. So the present list is specific. It has to be referred as the TM list (Taxonomic list not only Faunistic, FM list).
data("TM_list")data("TM_list")
A data frame with 1470 observations on the following 11 variables.
N.a numeric vector
MeditsCodea factor with levels of species codes in the RUBIN format (see MEDITS manual)
Scientific.Name.................................................valida factor with levels of the scientific names of the species
Authorshipa factor with levels of the authorship of the information
Sourcea factor with levels sources of the information
Referencea factor with levels of the bibliographic references
Remarksa factor with levels the reported remarks
CATFAUa factor with levels of the faunistic categories of the species
CODLONa factor with CODLON that represents the Length classes code: m = 1 mm; 0 = 0,5 cm; 1 = 1 cm.
GSAsa factor with levels of the Geographic Sub-Areas (GSA) adopted in the MEDITS protocol.
Yeara factor with levels of the years
W. Zupa
MEDITS MEDITS-Handbook, Version n. 9 (2017)
Anonymus. 2017. MEDITS-Handbook. Version n. 9. MEDITS Working Group. 106 pp.
data(TM_list) str(TM_list) head(TM_list)data(TM_list) str(TM_list) head(TM_list)