rEcaDataReport: Data report for R-ECA preparation

View source: R/RecaWrap.R

rEcaDataReportR Documentation

Data report for R-ECA preparation

Description

Generates overview of samples to inform on sample availability in potential cell definitions. Informs on which columns maybe be used as fixed effect covariates, and how grouping of covariates is best done for random effects.

The covariates in landings define the cells. For each cell the covariates defining the cell is reported, before the total landed weight, along with the number of unique occurances of covariates not in landings (including catchId and sampleId). Lastly the number of fish measurements for Age, Weight and Length is reported.

Usage

rEcaDataReport(samples, landings, covariates)

Arguments

samples

data.table() with samples (as in prepRECA), each row corresponding to one sampled fish. Contains columns:

catchId

Column identifying the catch that the sample was taken from. Typically a haul or a landing.

sampleId

Column identifying the sample. If only one sample is taken for each catch. This can be set equal to catchId

Age

integer() Age of fish.

Length

numeric() Length of fish. Must be complete (no NAs)

Weight

numeric() Weight of fish.

...

Additional columns which may be used as covariates.

landings

data.table() with total landings (as in prepRECA), each row corresponding to one cell. Contains columns:

LiveWeightKG

numeric(). Total landings (Live/Round weight in Kg) for the cell

...

Additional columns which may be used as covariates. These will define each cell.

covariates

character() vector of columns to consider for covariates.

Value

data.table() with columns

<Covariates in landings>

one column for each. Defines the cells.

LiveWeightKG

The total weight (kg) in the cell.

LiveWeightCumFraction

The fraction of landings in this cell AND all the cells with higher total weight than this cell.

<Count of covariates not in landings>

Count of unique values for covariate. one column for each. Column name is covariate name (from samples) prefixed with N

Ncatch

The number of unique catches sampled in the cell.

Nsample

The number of unique catch-samples in the cell.

Nage

The number of age readings in the cell.

Nweight

The number of fish weight measurements in the cell.

Nlength

The number of fish length measurements in the cell.

Examples

 data(catchsamples)
 catchsamples$catchId <- catchsamples$LEid
 catchsamples$sampleId <- catchsamples$SAid
 catchsamples$date <- catchsamples$LEdate
 catchsamples$Metier5 <- catchsamples$LEmetier5

 data(landings)
 landings$LiveWeightKG <- landings$OfficialLandingsWeight
 landings$Metier5 <- landings$FishingActivityCategoryEuropeanLvl5

 rEcaDataReport(catchsamples, landings, c("Metier5", "VDencrCode"))

StoXProject/RstoxFDA documentation built on Dec. 17, 2024, 10:58 a.m.