R/logbook_weighting_sample_control.R
logbook_weighting_sample_control.Rd
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 catch weight for activity
logbook_weighting_sample_control(
dataframe1,
dataframe2,
dataframe3,
output,
species = c("YFT", "SKJ", "BET", "ALB", "LTA", "FRI", "TUN", "KAW", "LOT"),
species_fate = "6",
epsilon = 0.01
)
data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_weighting_sample_control () function.
data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_weighting_sample_control () function.
data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_weighting_sample_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", "LTA", "FRI", "TUN", "KAW", "LOT"). list of the inventory of species (FAO code) used to compare to sample weighting.
character expected. Default values: "6". Vector of inventory of fate used to compare to sample weighting.
numeric expected, default : 0.01. Gives the threshold at which the difference is considered too large.
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 :
activity_id
catch_id
catch_weight
speciesfate_code
species_fao_code
activity_id
sampleactivity_id
sampleactivity_weightedweight
activity_id
#Activity 1, 3 and 5 are ok,
#Activity 2 has different weight,
#Activity 4 has weighted weight
dataframe1 <- data.frame(activity_id = c("1", "2", "3", "4", "5"))
dataframe2 <- data.frame(catch_id = c("1", "2", "3", "4", "5", "6"),
catch_weight = c(4, 2, 5, 10, 3, 8),
speciesfate_code = c("6", "6", "6", "6", "6", "6"),
species_fao_code = c("YFT", "JOS", "ALB", "YFT", "YFT", "FRI"),
activity_id = c("1", "1", "1", "2", "2", "5"))
dataframe3 <- data.frame(sampleactivity_id = c("1", "2", "3", "4", "5"),
sampleactivity_weightedweight = c(3, 6, 12.5, NA, 26),
activity_id = c("1", "1", "2", "3", "4"))
logbook_weighting_sample_control(dataframe1, dataframe2, dataframe3, output = "report")
#> activity_id logical weight weightedweight
#> 1 1 TRUE 9 9.0
#> 2 2 FALSE 13 12.5
#> 3 3 TRUE NA 0.0
#> 4 4 FALSE NA 26.0
#> 5 5 TRUE 8 NA