View source: R/landingsAnalyses.R
imputeCatchesLandings | R Documentation |
Imputes landings to represent individual catches of species from a trip, and redistributes selected values over the imputed landings. This mimics a situation where landings are reported for each catch rather than each trip. This is useful to obtain a higher resolution on some grouping variables and consolidate logbook records with landing records, while preserving data for landings not reported in logbooks, and preserving the total value equal to that in landings.
imputeCatchesLandings(
landings,
logbooks,
tripIdCol = "tripid",
catchIdCol,
speciesColLand = "Art FAO (kode)",
speciesColLog = "FANGSTART_FAO",
weightCol = "RUNDVEKT",
valueColumns = c("Bruttovekt", "Produktvekt", "Rundvekt")
)
landings |
|
logbooks |
|
tripIdCol |
character() that identifies the column in 'landings' and 'logbooks' that contain trip ids |
catchIdCol |
character() that identifies the column in 'logbooks' that contain catch ids |
speciesColLand |
character() that identifies the column in 'landings' that contain species ids |
speciesColLog |
character() that identifies the column in 'logbooks' that contain species ids |
weightCol |
character() that identifies the column in 'logbooks' that contain the weights to use for redistribution of value columns. |
valueColumns |
character() vector with names of columns that should be redistributed over the imputed landings |
The result of imputation have added lines for each corresponding catch in logbooks, and 'valueColumns' redistributed to reflect the fraction of 'weightCol' that each catch contributes to the total trip catch of the species ('speciesColLog').
Important: columns in landings that are not in 'valueColumns' will be duplicated exactly for the imputed catches. That means that any weight-column not in 'valueColumns' will result in duplicated total weights for that column. That also means that any identifiers / keys may be copied and thus be rendered non-unique in the imputed landings.
Landings for which no trip can be found in 'logbooks' are left untouched. logbook entries with no corresponding landings are ignored.
Default values for parameters 'speciesCol' and 'valueColumns' are suitable for data read with readLssFile
.
Default values for 'tripIdCol' corresponds to defaults for makeTripIds
, appendTripIdLandings
, and appendTripIdLogbooks
.
data.table
with 'landings' that have artificial landings imputed, each catch identified by the added column 'catchIdCol'.
makeTripIds
, appendTripIdLandings
, and appendTripIdLogbooks
for obtaining 'landings' with trip-ids.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.