The purpose of the logbook_harbour_control function is to provide a table of data that contains an inconsistency with the harbour of landing of the previous trip and the harbour of departure of the current trip

logbook_harbour_control(dataframe1, output)

Arguments

dataframe1

data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_harbour_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 :

  • trip_id

  • harbour_id_departure

  • harbour_label_departure

  • trip_previous_id

  • harbour_id_landing_trip_previous

  • harbour_label_landing_trip_previous

Examples

#Trip 1 and 2 are ok,
#Trip 3 has different harbour,
#Trip 4 has no harbour departure,
#Trip 5 has no harbour landing for trip previous
dataframe1 <- data.frame(trip_id = c("1", "2", "3", "4", "5"),
                         harbour_id_departure = c("1", "2", "3", NA, "1"),
                         harbour_label_departure = c("Harbour_1", "Harbour_2", "Harbour_3", NA,
                                                     "Harbour_1"),
                         trip_previous_id = c(NA, "1", "2", NA, "6"),
                         harbour_id_landing_trip_previous = c(NA, "2", "2", NA, NA),
                         harbour_label_landing_trip_previous = c(NA, "Harbour_2", "Harbour_2", NA,
                                                                 NA))
logbook_harbour_control(dataframe1, output = "report")
#>   trip_id logical harbour_label_landing_trip_previous harbour_label_departure
#> 1       1    TRUE                                <NA>               Harbour_1
#> 2       2    TRUE                           Harbour_2               Harbour_2
#> 3       3   FALSE                           Harbour_2               Harbour_3
#> 4       4   FALSE                                <NA>                    <NA>
#> 5       5   FALSE                                <NA>               Harbour_1