R/logbook_little_big_control.R
logbook_little_big_control.Rd
The purpose of the logbook_little_big_control function is to provide a table of data that contains an inconsistency between the percentage of little and big fish sampled
logbook_little_big_control(
dataframe1,
dataframe2,
dataframe3,
output,
species_big = c("YFT", "YFT", "BET", "BET", "ALB", "ALB"),
size_measure_type_big = c("PD1", "FL", "PD1", "FL", "PD1", "FL"),
threshold_size_big = c(24, 80, 25, 77, 23.5, 78),
size_measure_type = c("FL", "PD1"),
threshold = 0.9
)
data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_little_big_control() function.
data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_little_big_control() function.
data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_little_big_control() function.
character expected. Kind of expected output. You can choose between "message", "report" or "logical".
character expected. Default values: c("YFT", "YFT", "BET", "BET", "ALB", "ALB"). Vector of the species. First criterion for identifying big fish (other values are small fish)
character expected. Default values: c("PD1", "FL", "PD1", "FL", "PD1", "FL"). Vector of the size measure type. Second criterion for identifying big fish (other values are small fish)
numeric expected. Default values: c(24, 80, 25, 77, 23.5, 78). Vector for defining the lower or equal for threshold size measurement. Third criterion for identifying big fish (other values are small fish)
character expected. Default values: c("FL", "PD1"). Vector with the preferred type of size measurement for small fish and then for big fish
numeric expected. Default values: 0.9. Threshold for percentage of small or big fish
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 :
sample_id
sample_smallsweight
sample_bigsweight
sample_totalweight
samplespecies_id
species_fao_code
sizemeasuretype_code
sample_id
samplespeciesmeasure_id
samplespeciesmeasure_sizeclass
samplespeciesmeasure_count
samplespecies_id
#Sample 1, 2, 4, 5, 7, 8 and 9 are ok,
#Sample 3 has a percentage of big below the threshold,
#Sample 6 has a percentage of little below the threshold,
#Sample 10 has a percentage of little below the threshold,
#Sample 11 has a percentage of little below the threshold,
#Sample 12 has a percentage of big below the threshold
dataframe1 <- data.frame(sample_id = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11",
"12"),
sample_smallsweight = c(10, 20, 1, 30, 3, 7, 4, 12, 0, 0, 3, 0),
sample_bigsweight = c(NA, 2, 9, 3, 5, 4, 13, 5, 0, NA, 0, 4),
sample_totalweight = c(NA, NA, NA, 33, NA, NA, 7, 2, 0, 5, 0, 0))
dataframe2 <- data.frame(samplespecies_id = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11", "12"),
species_fao_code = c("YFT", "BET", "BET", "YFT", "ALB", "YFT", "YFT",
"BET", "YFT", "ALB", "YFT", "YFT"),
sizemeasuretype_code = c("PD1", "PD1", "FL","PD1", "FL", "FL", "PD1",
"FL", "PD1", "PD1", "PD1", "PD1"),
sample_id = c("1", "2", "2", "3", "4", "5", "5", "6", "6", "8", "9", "10"))
dataframe3 <- data.frame(samplespeciesmeasure_id = c("1", "2", "3", "4", "5", "6", "7", "8", "9",
"10", "11", "12"),
samplespeciesmeasure_sizeclass = c(20, 26, 70, 20, 10, 45, 36, 30, 32, 24,
13, 13),
samplespeciesmeasure_count = c(5, 1, 9, 8, 10, 25, 2, 16, 4, 3, 6, 6),
samplespecies_id = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11", "12"))
logbook_little_big_control(dataframe1, dataframe2, dataframe3, output = "report")
#> sample_id logical sample_smallsweight sample_bigsweight sample_totalweight
#> 1 1 TRUE 10 NA NA
#> 2 10 FALSE 0 NA 5
#> 3 11 FALSE 3 0 0
#> 4 12 FALSE 0 4 0
#> 5 2 TRUE 20 2 NA
#> 6 3 FALSE 1 9 NA
#> 7 4 TRUE 30 3 33
#> 8 5 TRUE 3 5 NA
#> 9 6 FALSE 7 4 NA
#> 10 7 TRUE 4 13 7
#> 11 8 TRUE 12 5 2
#> 12 9 TRUE 0 0 0
#> little_percentage big_percentage measure1_percentage measure2_percentage
#> 1 1.0000000 0.00000000 0.0000000 1.00000000
#> 2 1.0000000 0.00000000 0.0000000 1.00000000
#> 3 0.0000000 0.00000000 0.0000000 0.00000000
#> 4 0.0000000 0.00000000 0.0000000 0.00000000
#> 5 0.9000000 0.10000000 0.9000000 0.10000000
#> 6 1.0000000 0.00000000 0.0000000 1.00000000
#> 7 1.0000000 0.00000000 1.0000000 0.00000000
#> 8 0.9259259 0.07407407 0.9259259 0.07407407
#> 9 0.8000000 0.20000000 0.8000000 0.20000000
#> 10 0.0000000 0.00000000 0.0000000 0.00000000
#> 11 0.0000000 1.00000000 0.0000000 1.00000000
#> 12 1.0000000 0.00000000 0.0000000 1.00000000