The purpose of the logbook_buoy_time_control function is to provide a table of data that contains an inconsistency between the time elapsed for an operation on a floating object with the same buoy

logbook_buoy_time_control(dataframe1, dataframe2, output, threshold_time = 60)

Arguments

dataframe1

data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_buoy_time_control () function.

dataframe2

data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_buoy_time_control () function.

output

character expected. Kind of expected output. You can choose between "message", "report" or "logical".

threshold_time

numeric expected. Default values: 60 Maximum valid time threshold (minutes) between operation on the same buoy.

Value

The function returns a character with output is "message", two data.frame with output is "report" (the first without geographical location and the second with geographical location), a logical with output is "logical"

Details

The input dataframe must contain all these columns for the function to work :

  • transmittingbuoy_id

  • transmittingbuoy_code

  • transmittingbuoytype_id

  • activity_id

  • activity_id

  • activity_date

  • activity_time

  • trip_id

Examples

#Buoy 1, 2, 3, 4 and 5 are ok,
#Buoy 6 is followed by an operation on the same object within a time interval shorter than
# the threshold
#Buoy 7 is preceded by an operation on the same object within a time interval shorter than
# the threshold
#Buoy 8 is linked to an activity that involves two operations on the same object
#Buoy 9 is linked to an activity that involves two operations on the same object
dataframe1 <- data.frame(transmittingbuoy_id = c("1", "2", "3", "4", "5", "6", "7", "8", "9"),
                         transmittingbuoy_code = c("1", "1", "1", "1", "2", "3", "3", "4", "4"),
                         transmittingbuoytype_id = c("1", "2", "2", "2", "2", "1", "1", "2", "2"),
                         activity_id = c("1", "2", "3", "4", "5", "6", "7", "8", "8"))
dataframe2 <- data.frame(activity_id = c("1", "2", "3", "4", "5", "6", "7", "8"),
                         activity_date = as.Date(c("2020/01/01", "2020/01/01", "2020/01/01",
                                                   "2020/01/01", "2020/01/01", "2020/01/02",
                                                   "2020/01/02", "2020/01/03")),
                         activity_time = c("15:26:01", "15:36:01", "17:49:00", "18:30:00",
                                           "18:31:00", "09:26:01", "09:42:01", "21:35:01"),
                         trip_id = c("1", "1", "1", "2", "2", "2", "2", "2"))
logbook_buoy_time_control(dataframe1, dataframe2, output = "report")
#> # A tibble: 9 × 7
#>   transmittingbuoy_id transmittingbuoy_code activity_date activity_time
#>   <chr>               <chr>                 <date>        <chr>        
#> 1 1                   1                     2020-01-01    15:26:01     
#> 2 2                   1                     2020-01-01    15:36:01     
#> 3 3                   1                     2020-01-01    17:49:00     
#> 4 4                   1                     2020-01-01    18:30:00     
#> 5 5                   2                     2020-01-01    18:31:00     
#> 6 6                   3                     2020-01-02    09:26:01     
#> 7 7                   3                     2020-01-02    09:42:01     
#> 8 8                   4                     2020-01-03    21:35:01     
#> 9 9                   4                     2020-01-03    21:35:01     
#> # ℹ 3 more variables: time_interval_before <drtn>, time_interval_after <drtn>,
#> #   logical <lgl>