knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(RstoxFDA)

This vignette introduces how to use RstoxFDA functions in the StoX user interface to generate some common reports for overview of fishing activity and how its sampled. Some data preparation may be necessary, and the vignette StoX FDA data preparation (baseline) introduces some common data-preparation tasks for Fisheries dependent analysis (FDA) with formats commonly used at the Institute of Marine Research (IMR). One you have created a StoX-baseline as introduced in that vignette, you will have landing-data (RstoxData::StoxLandingData) and sample-data (RstoxData::StoxBioticData) with complete records and with harmonized coding-systems, and the functions introduced here can be applied directly. The functions introduced here may be added to the "report"-tab in the StoX user inteface.

This document introduces some problems and tasks, and how RstoxFDA-functions may be applied to solve them. The details of how to use the functions introduced here is provided as function documentation viewable in the StoX "function description"-tab, or in an R-console via '?', e.g:

?RstoxFDA::ReportFdaLandings

Documentation for data formats are provided in the same way. E.g.:

?RstoxFDA::ReportFdaLandingData

As StoX is composed of several R-packages. Functions will be referred to by their package name with the notation package::function. In the StoX user interface, the package that functions belong to are not visible. Any data formats are similarly denoted package::format.

Installation

RstoxFDA is an optional package in StoX. In order to use the functions introduced in this vignette in the StoX user interface, make sure RstoxFDA is installed. See installation instructions on github: StoXProject/RstoxFDA. To install the StoX user interface, see instructions on github: StoXProject/StoX

Reports

The report functions display reports in StoX. All reports are displayed in StoX, and in addition written into the StoX-project directory in a standardized format for tabular data. They may be imported into other software change how rows are sorted or to generate custom plots.

Landing report

The StoX-baseline functions allows for obtaining RstoxData::StoxLandingData in an aggregated, but still rather detailed format. Temporally the data is aggregated by date, and landing site, gear, and vessel length is included to the highest resolution available. More practical summaries of the landing statistics can be obtained with the function RstoxFDA::ReportFdaLandings. This function aggregates the total landed weight, by any combination of columns that exist in RstoxData::StoxLandingData, included any columns added in StoX-baseline. The unit for the reported weight and any rounding of the reported weight is configurable. Following R-convention, rounding to nearest 10th or 100th may be specified by providing negative numbers. Below is an example of a report in tons, aggregated by quarter and gear-group and rounded to the nearest 1000 tons. The variables 'ReportPeriod' (Quarter) and 'GearGroup' have been added in StoX-baseline.

| ReportPeriod | GearGroup | LandedRoundWeight | |:------:|:-----:|------:| |Q1|D.Seine|31000| |Q1|Gillnet|27000| |Q2|D.Seine|16000| |Q2|Gillnet|10000| |Q2|Juksa|5000| |Q1|Juksa|4000|

This table was produced by a process named "LandingsOverview" and was therefore also located in the StoX project directory under "output/report/LandingsOverview/FisheriesLandings.txt".

The input to this report function is set with explicit reference to the StoX-baseline process that data should be fetch from. This means that if it is desired to split a report into several reports according to the values in RstoxData::StoxLandingData, that may be achieved by adding instances of RstoxData::FilterStoxLanding to the StoX-baseline. The report above could for instance be made for several species, by configuring filters accordingly.

Sampling report

It is often desired to inspect how sampling programs have covered the fishing activity. That can be done by defining partitions of the fisheries. For instance one might one to partition the fishery by gear, quarter and area, and tabulate how the sampling covered each partition. For this it is necessary that samples and landing data are coded in a harmonized fashion, using for instance the same gear-codes. If that is the case, RstoxFDA::ReportFdaSampling can be used to generate such tables for comparison. The variables that define the partition are provided as the function parameter 'GroupingVariables' (e.g. 'GearGroup', 'Stratum', and 'Period' for gear, area and quarter). Since FDA-data are typically sampled in highly clustered fashion, the effective sample sizes are not simply determined by the number of observations made (length measurements or age readings), but also by the number of catches or vessels that these measurements where obtained from. Some common clustering factors are therefore reported along with the count of observations. As for RstoxFDA::ReportFdaLandings, units and rounding are configurable.

The example below depicts a comparison of samples and landings. Notice that the partitioning of the fishery occur as the leftmost columns, along with the total landed weight in that partition (The columns 'GearGroup', 'Stratum', 'Period' and 'LandedRoundWeight'). Since the variables defining the partition need to be defined with the same coding system in both the sample data and the landing data, RstoxFDA::ReportFdaSampling requires them to have the same column name, and only provide those columns as option for the 'GroupingVariables'.

| GearGroup | Stratum | Period | LandedRoundWeight | Catches | Vessels | WeightMeasurments | LengthMeasurments | AgeReadings | WeightOfSampledCatches | |:------:|:-----:|:------:|------:|------:|------:|------:|------:|------:|------:| | D.Seine | s000-501 | Q1 | 19870 | 9 | 9 | 160 | 180 | 180 | 159 | | Gillnet | s000-501 | Q1 | 13314 | 38 | 30 | 500 | 1683 | 1683 | 178 | | D.Seine | s500 | Q2 | 2612 | - | - | - | - | - | - | | Trawl | s300-400 | Q1 | - | 9 | 9 | 185 | 185 | 185 | 10

In this case the GearGroup, Stratum and Period has been obtained by adding and re-coding variables in the StoX-baseline for both RstoxData::StoxLandingData and RstoxData::StoxBioticData. We may note that Demershal Seine (D. Seine) in Stratum s500 was not sampled at all in quarter 2 (Q2). We may also note the somewhat peculiar fact that Trawl in Stratum s300-400 was sampled in quarter 1 (Q1), even if there are no recorded landings then. This occurs from time to time and need to be handled for many kinds of analysis, by changing gear-groups, periodicity or other kinds of data re-configuration. The main reason why this occurs is that samples are often provided with higher temporal and spatial resolution than the landings. Samples of catches from a known fishing operation will typically be assigned the temporal and spatial variables that describe that fishing operation, while a landing consist of many fishing operations and only the dominant spatio-temporal variables are reported for landings. The issue may also occasionally arise due to error in sample-records or sales-notes.

Tabulating multiple sampling programs

When evaluating sampling coverage from several sampling programs, it may be of interest to inspect which sampling programs cover which parts of the fisheries. If the sampling program is identified by some variable in RstoxData::StoxBioticData, this variable can be provided as a 'SamplingVariable' to RstoxFDA::ReportFdaSampling in order to specify further partitioning of data. The example below illustrates this with the variable 'missiontypename' that identifies the sampling programs. Note that the leftmost columns that represent the partitioning of the fishery are repeated. In particular the 'LandedRoundWeight' is repeated, so that the sum of this column does no longer represent the total landings. Immediately to the right of 'LandedRoundWeight', the sampling variable 'missiontypename' is listed. This represent the different sampling programs that samples are collected from, and the sample summaries in the columns to the right of this is partitioned on each sampling program.

| GearGroup | Stratum | Period | LandedRoundWeight | missiontypename | Catches | Vessels | WeightMeasurments | LengthMeasurments | AgeReadings | WeightOfSampledCatches | |:------:|:-----:|:------:|------:|:------:|------:|------:|------:|------:|------:|------:| | D.Seine | s000-501 | Q1 | 19870 | Prøvebåt | 8 | 8 | 160 | 160 | 160 | 158 | | D.Seine | s000-501 | Q1 | 19870 | Referanseflåten-Kyst | 1 | 1 | 0 | 20 | 20 | 0 | | Gillnet | s000-501 | Q1 | 13314 | Prøvebåt | 20 | 20 | 302 | 402 | 402 | 66 | | Gillnet | s000-501 | Q1 | 13314 | Referanseflåten-Hav | 9 | 2 | 197 | 197 | 197 | 24 | | Gillnet | s000-501 | Q1 | 13314 | Referanseflåten-Kyst | 27 | 8 | 1 | 1084 | 1084 | 88 |

'missiontypename' is not a regular column in RstoxData::StoxBioticData, but and was added with the function RstoxData::AddToStoxBiotic, as this data was sourced from NMDbiotic.

Analysis

The functions introduced in this vignette should enable you to use IMR samples and FDIR landings to obtain simple reports on fishing activity and how it is covered by sampling programs. Other analysis will be introduced in other vignettes. All analysis relies on proper data preparation described in the vignette StoX FDA data preparation (baseline).



StoXProject/RstoxFDA documentation built on Jan. 13, 2024, 12:32 a.m.