The purpose of the logbook_weighting_sample_control function is to provide a table of data that contains an inconsistency between the sample weighting and weight in well

logbook_weighting_sample_control(
  dataframe1,
  dataframe2,
  output,
  species = c("YFT", "SKJ", "BET", "ALB", "LTA", "FRI", "TUN", "KAW", "LOT"),
  epsilon = 0.01
)

Arguments

dataframe1

data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_weighting_sample_control () function.

dataframe2

data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_weighting_sample_control () function.

output

character expected. Kind of expected output. You can choose between "message", "report" or "logical".

species

character expected. Default values: c("YFT", "SKJ", "BET", "ALB", "LTA", "FRI", "TUN", "KAW", "LOT"). list of the inventory of species (FAO code) used to compare to sample weighting.

epsilon

numeric expected, default : 0.01. Gives the threshold at which the difference is considered too large.

Value

The function returns a character with output is "message", a data.frame with output is "report", a logical with output is "logical"

Details

The input dataframe must contain all these columns for the function to work :

  • sampleactivity_id

  • sampleactivity_weightedweight

  • sample_well

  • activity_id

  • trip_id

  • wellactivityspecies_id

  • wellactivityspecies_weight

  • species_fao_code

  • well_label

  • activity_id

  • trip_id

Examples

#Sample activity 1, 2, 3, 4, 5, 6 and 7 are ok,
#Sample Activity 8 has weights missing from the well,
#Sample Activity 9 does not take into account all species
#Sample Activity 10 does not take into account all well
#Sample Activity 11 has weighted weight missing
dataframe1 <- data.frame(sampleactivity_id = c("1", "2", "3", "4", "5", "6", "7", "8", "9",
                                               "10", "11"),
                         sampleactivity_weightedweight = c(3, 6, 20, 6.25, 13.75, 7.6, 2, 2,
                                                           26, 13, NA),
                         sample_well = c("well_1", "well_2", "well_1", "well_1", "well_2",
                                         "well_1", "well_2", "well_1", "well_1", "well_1",
                                         "well_1"),
                         activity_id = c("1", "1", "2", "3", "3", "4", "5", "6", "7", "8", "9"),
                         trip_id = c("1", "1", "2", "3", "3", "4", "4", "5", "6", "7", "8"))
dataframe2 <- data.frame(wellactivityspecies_id = c("1", "2", "3", "4", "5", "6", "7", "8", "9",
                                                    "10", "11", "12", "13", "14", "15", "16", "17"),
                         wellactivityspecies_weight = c(3, 2, 4, 1, 15, 5, 5, 11, 4, 4, 6, 9,
                                                        2, 26, 2, 13, 6),
                         species_fao_code = c("YFT", "SKJ", "ALB", "JOS", "YFT", "FRI", "YFT",
                                              "SKJ", "BET", "YFT", "YFT", "ALB", "YFT", "ALB",
                                              "YFT", "BET", "ALB"),
                         well_label = c("well_1", "well_2", "well_2", "well_2", "well_1", "well_2",
                                        "well_1", "well_2", "well_3", "well_1", "well_2", "well_3",
                                        "well_2", "well_1", "well_1", "well_1", "well_2"),
                         activity_id = c("1", "1", "1", "1", "2", "2", "3", "3", "3", "4", "4", "4",
                                         "5", "7", "7", "8", "8"),
                         trip_id = c("1", "1", "1", "1", "2", "2", "3", "3", "3", "4", "4", "4",
                                     "4", "6", "6", "7", "7"))
logbook_weighting_sample_control(dataframe1, dataframe2, output = "report")
#>    sampleactivity_id sampleactivity_weightedweight logical weightedweight_well
#> 1                  1                          3.00    TRUE                3.00
#> 2                  2                          6.00    TRUE                6.00
#> 3                  3                         20.00    TRUE               20.00
#> 4                  4                          6.25    TRUE                6.25
#> 5                  5                         13.75    TRUE               13.75
#> 6                  6                          7.60    TRUE                7.60
#> 7                  7                          2.00    TRUE                2.00
#> 8                  8                          2.00   FALSE                  NA
#> 9                  9                         26.00   FALSE               28.00
#> 10                10                         13.00   FALSE               19.00
#> 11                11                            NA   FALSE                  NA