The purpose of the logbook_super_sample_number_control function is to provide a table of data that contains an inconsistency between the sample and the subsample number

logbook_super_sample_number_control(dataframe1, dataframe2, output)

Arguments

dataframe1

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

dataframe2

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

output

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

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 :

  • sample_id

  • sample_supersample

  • samplespecies_id

  • samplespecies_subsamplenumber

  • sample_id

Examples

#Sample 1 and 2 are ok,
#Sample 3 is not a super sample but the numbering starts at 1 instead of 0,
#Sample 4 is a super sample but the same sub-sample number appears twice,
#Sample 5 has no sample species,
#Sample 6 is a super sample but the numbering starts at 0 instead of 1,
#Sample 7 is a super sample but has only one sub-sample species
dataframe1 <- data.frame(sample_id = c("1", "2", "3", "4", "5", "6", "7"),
                         sample_supersample = c(FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE))
dataframe2 <- data.frame(samplespecies_id = c("1", "2", "3", "4", "5", "6", "7", "8", "9"),
                         samplespecies_subsamplenumber = c(0, 1, 2, 1, 1, 1, 0, 1, 1),
                         sample_id = c("1", "2", "2", "3", "4", "4", "6", "6", "7"))
logbook_super_sample_number_control(dataframe1, dataframe2, output = "report")
#>   sample_id logical sample_supersample count_subsamplenumber_n0
#> 1         1    TRUE              FALSE                        0
#> 2         2    TRUE               TRUE                        2
#> 3         3   FALSE              FALSE                        1
#> 4         4   FALSE               TRUE                        2
#> 5         5   FALSE              FALSE                       NA
#> 6         6   FALSE               TRUE                        1
#> 7         7   FALSE               TRUE                        1
#>   count_subsamplenumber_0 count_subsamplenumber_1 count_subsamplenumber
#> 1                       1                       0                     1
#> 2                       0                       1                     2
#> 3                       0                       1                     1
#> 4                       0                       2                     1
#> 5                      NA                      NA                    NA
#> 6                       1                       1                     2
#> 7                       0                       1                     1