R/logbook_weigh_catch_well_control.R
logbook_weigh_catch_well_control.RdThe purpose of the logbook_weigh_catch_well_control function is to provide a table of data that contains an inconsistency between the catch weight and weight in well
data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_weigh_catch_well_control () function.
data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_weigh_catch_well_control () function.
character expected. Kind of expected output. You can choose between "message", "report" or "logical".
character expected. Default values: c("YFT", "SKJ", "BET", "ALB"). list of of species (FAO code) listed separately in the well plan.
character expected. Default values: c("6", "15"). Vector of inventory of fate retained on board.
character expected. Default values: "XXX*". Code for accessory species grouped together within the well plan
The function returns a character with output is "message", a data.frame with output is "report", a logical with output is "logical"
The input dataframe must contain all these columns for the function to work :
catch_id
catch_weight
speciesfate_code
species_fao_code
activity_id
wellactivityspecies_id
wellactivityspecies_weight
species_fao_code
activity_id
#Activity 1 are ok,
#Activity 2 has different weight,
#Activity 3 has well missing,
#Activity 4 has catch missing,
dataframe1 <- data.frame(catch_id = c("1", "2", "3", "4", "5", "6"),
catch_weight = c(3, 2, 4, 1, 15, 6),
speciesfate_code = c("6", "6", "6", "11", "6", "6"),
species_fao_code = c("YFT", "SKJ", "FRI", "JOS", "ALB", "FRI"),
activity_id = c("1", "1", "1", "1", "2", "3"))
dataframe2 <- data.frame(wellactivityspecies_id = c("1", "2", "3", "4", "5"),
wellactivityspecies_weight = c(3, 2, 4, 13, 4),
species_fao_code = c("YFT", "SKJ", "XXX*", "ALB", "BET"),
activity_id = c("1", "1", "1", "2", "4"))
logbook_weigh_catch_well_control(dataframe1, dataframe2, output = "report")
#> Warning: 2026-01-26 10:25:09 - your data has some peculiarities that prevent the verification of inconsistencies.
#> Missing catch or well (1):4
#> # A tibble: 4 × 12
#> activity_id logical `ALB catch` `ALB well` `BET catch` `BET well` `SKJ catch`
#> <chr> <lgl> <dbl> <dbl> <lgl> <dbl> <dbl>
#> 1 1 TRUE NA NA NA NA 2
#> 2 3 FALSE NA NA NA NA NA
#> 3 2 FALSE 15 13 NA NA NA
#> 4 4 FALSE NA NA NA 4 NA
#> # ℹ 5 more variables: `SKJ well` <dbl>, `YFT catch` <dbl>, `YFT well` <dbl>,
#> # `XXX* catch` <dbl>, `XXX* well` <dbl>