The purpose of the logbook_ldlf_control function is to provide a table of data that contains an inconsistency between the sample measurement types and species or weight values

logbook_ldlf_control(
  dataframe1,
  dataframe2,
  output,
  species = c("SKJ", "LTA", "FRI"),
  size_measure_type_species = c("PD1"),
  size_measure_type_big = c("PD1"),
  size_measure_type_small = c("FL")
)

Arguments

dataframe1

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

dataframe2

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

output

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

species

character expected. Default values: c("SKJ", "LTA", "FRI"). Vector of the species not to be associated with a type of measure.

size_measure_type_species

character expected. Default values: c("PD1"). Vector of type of measure not to be associated with species

size_measure_type_big

character expected. Default values: c("PD1"). Type of measure that must have a total weight or a big fish weight

size_measure_type_small

character expected. Default values: c("FL"). Type of measure that must have a total weight or a small fish weight

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 :

  • samplespecies_id

  • species_fao_code

  • sizemeasuretype_code

  • sample_id

  • sample_id

  • sample_smallsweight

  • sample_bigsweight

  • sample_totalweight

Examples

#Sample species 1, 3 and 4 are ok,
#Sample species 2 has a species that is not compatible with the type of measure,
#Sample species 5 has no smalls weight nor total weight,
#Sample species 6 has no bigs weight nor total weight
dataframe1 <- data.frame(samplespecies_id = c("1", "2", "3", "4", "5", "6"),
                         species_fao_code = c("SKJ", "SKJ", "JOS", "SKJ", "SKJ", "JOS"),
                         sizemeasuretype_code = c("FL", "PD1", "PD1", "FL", "FL", "PD1"),
                         sample_id = c("1", "1", "1", "2", "3", "4"))
dataframe2 <- data.frame(sample_id = c("1", "2", "3", "4"),
                         sample_smallsweight = c(5, 0, 0, 7),
                         sample_bigsweight = c(12, NA, 6, 0),
                         sample_totalweight = c(0, 23, NA, NA))
logbook_ldlf_control(dataframe1, dataframe2, output = "report")
#>   samplespecies_id logical sizemeasuretype_code species_fao_code
#> 1                1    TRUE                   FL              SKJ
#> 2                2   FALSE                  PD1              SKJ
#> 3                3    TRUE                  PD1              JOS
#> 4                4    TRUE                   FL              SKJ
#> 5                5   FALSE                   FL              SKJ
#> 6                6   FALSE                  PD1              JOS
#>   sample_bigsweight sample_smallsweight sample_totalweight
#> 1                12                   5                  0
#> 2                12                   5                  0
#> 3                12                   5                  0
#> 4                NA                   0                 23
#> 5                 6                   0                 NA
#> 6                 0                   7                 NA