R/logbook_raising_factor_control.R
logbook_raising_factor_control.Rd
The purpose of the logbook_raising_factor_control function is to provide a table of data that contains an inconsistency with the RF1 and the valid threshold (Default : 0.9 ; 1.1)
logbook_raising_factor_control(
dataframe1,
dataframe2,
dataframe3,
dataframe4,
output,
country_species = list(`1` = c("TUN", "ALB", "YFT", "BET", "SKJ"), `4` = c("LOT",
"TUN", "ALB", "YFT", "BET", "SKJ", "LTA", "FRI", "BLF", "RAV*", "KAW", "FRZ", "BLT")),
species_fate = "6",
vessel_activity = c("23", "25", "27", "29"),
threshold = c(0.9, 1.1)
)
data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_raising_factor_control () function.
data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_raising_factor_control () function.
data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_raising_factor_control () function.
data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_raising_factor_control () function.
character expected. Kind of expected output. You can choose between "message", "report" or "logical".
character expected. Default values: list("1" = c("TUN", "ALB", "YFT", "BET", "SKJ"), "4" = c("LOT", "TUN", "ALB", "YFT", "BET", "SKJ", "LTA", "FRI", "BLF", "RAV*", "KAW", "FRZ", "BLT")). list of the inventory of species (FAO code) used to calculate catch weight in RF1 by country (country code).
character expected. Default values: "6". Vector of inventory of fate used to calculate catch weight in RF1.
character expected. Default values: c("23", "25", "27", "29"). Vector of inventory of vessel activity NOT used to calculate catch weight in RF1.
numeric expected. Default values: 0.9 and 1.1. Vector containing the lower and upper acceptable threshold for RF1.
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 :
trip_id
catch_id
catch_weight
speciesfate_code
species_fao_code
vesselactivity_code
trip_id
landing_id
landing_weight
species_fao_code
trip_id
trip_id
trip_end_full_trip_id
vessel_id
country_fleetcountry
#Trip 1, 3, 4 and 7 are ok,
#Trip 2 has an RF1 outside the thresholds,
#Trip 5 has no landing weight,
#Trip 6 has no catch weight
dataframe1 <- data.frame(trip_id = c("1", "2", "3", "4", "5", "6", "7"))
dataframe2 <- data.frame(catch_id = c("1", "2", "3", "4", "5", "6", "7", "8", "9"),
catch_weight = c(10, 2, 15, 8, 5, 25, 4, 5, 9),
speciesfate_code = c("6", "6", "1", "6", "6", "6", "6", "6", "6"),
species_fao_code = c("TUN", "YFT", "TUN", "TUN", "TUN", "SKJ", "SKJ",
"LOT", "BET"),
vesselactivity_code = c("1", "1", "1", "1", "1", "1", "23", "1", "1"),
trip_id = c("1", "1", "1", "2", "2", "3", "3", "3", "5"))
dataframe3 <- data.frame(landing_id = c("1" , "2", "3", "4", "5"),
landing_weight = c(9, 2, 8, 25, 12),
species_fao_code = c("YFT", "TUN", "TUN", "TUN", "BET"),
trip_id = c("1", "1", "2", "4", "6"))
dataframe4 <- data.frame(trip_id = c("1", "2", "3", "4", "5", "6", "7"),
trip_end_full_trip_id = c("1", "2", "4", "4", "5", "6", "7"),
vessel_id = c("1", "1", "1", "1", "1", "1", "1"),
country_fleetcountry = c("1", "1", "1", "1", "1", "1", "1"))
logbook_raising_factor_control(dataframe1, dataframe2, dataframe3, dataframe4, output = "report")
#> trip_id logical rf1
#> 1 1 TRUE 0.9166667
#> 2 2 FALSE 0.6153846
#> 3 3 TRUE 1.0000000
#> 4 4 TRUE 1.0000000
#> 5 5 FALSE NA
#> 6 6 FALSE NA
#> 7 7 TRUE NA