R/logbook_operation_control.R
logbook_operation_control.Rd
The purpose of the logbook_operation_control function is to provide a table of data that contains an inconsistency with succes status and vessel activity, the type of school or the weight caught
data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_operation_control () function.
character expected. Kind of expected output. You can choose between "message", "report" or "logical".
character expected. Default values: c("6"). Vector of inventory of codes for activities that must have a success status
character expected, default : c("0"). Vector of inventory of code of the school type must not have specific success status (defined success_status_school_type)
character expected, default : c("0", "1"). Vector of inventory of code of the success status must not have specific school type (defined school_type)
character expected, default : c("0"). Vector of inventory of code of the success status must not have weigth
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
schooltype_code
successstatus_code
activity_weight
vesselactivity_code
#Activity 1, 2, 4 and 8 are ok,
#Activity 3 has no weight,
#Activity 5 has success status,
#Activity 6 has no school type,
#Activity 7 has no success status,
#Activity 9 has success status in success_status_school_type,
#Activity 10 has weight
dataframe1 <- data.frame(activity_id = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"),
schooltype_code = c("2", "1", "2", NA, NA, NA, "1", "0", "0", "0", "1"),
successstatus_code = c("1", "0", "2", NA, "2", "2", NA, "2", "1", "2",
"0"),
activity_weight = c(10, 0, 0, NA, NA, 6, 8, 2, 8, NA, 4),
vesselactivity_code = c("6", "6", "6", "1", "1", "6", "6", "6", "6", "6",
"6"))
logbook_operation_control(dataframe1, output = "report")
#> activity_id logical vesselactivity_code successstatus_code schooltype_code
#> 1 1 TRUE 6 1 2
#> 2 2 TRUE 6 0 1
#> 3 3 FALSE 6 2 2
#> 4 4 TRUE 1 <NA> <NA>
#> 5 5 FALSE 1 2 <NA>
#> 6 6 FALSE 6 2 <NA>
#> 7 7 FALSE 6 <NA> 1
#> 8 8 TRUE 6 2 0
#> 9 9 FALSE 6 1 0
#> 10 10 FALSE 6 2 0
#> 11 11 FALSE 6 0 1
#> activity_weight
#> 1 10
#> 2 0
#> 3 0
#> 4 NA
#> 5 NA
#> 6 6
#> 7 8
#> 8 2
#> 9 8
#> 10 NA
#> 11 4