The purpose of the logbook_position_control function is to provide a table of data that contains an inconsistency with ocean declaration and activity position

logbook_position_control(
  dataframe1,
  dataframe2,
  dataframe3,
  output,
  activity_crs = 4326,
  harbour_crs = 4326,
  buffer_harbour = 11100,
  buffer_sea = 925
)

Arguments

dataframe1

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

dataframe2

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

dataframe3

data.frame expected. Layer to containing the seas shapefile (example cf : cf : Flanders Marine Institute. IHO Sea Areas, version 1. Available online at https://www.marineregions.org/)

output

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

activity_crs

numeric expected. Default values: 4326. Coordinate Reference Systems for the position activity

harbour_crs

numeric expected. Default values: 4326. Coordinate Reference Systems for the position harbour

buffer_harbour

numeric expected. Default values: 11100. Buffer to be used for harbour, in meter

buffer_sea

numeric expected. Default values: 925. Buffer to be used for seas, in meter

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 :

  • activity_id

  • ocean_label

  • activity_position

  • trip_id

  • trip_id

  • harbour_position_departure

  • harbour_position_landing

  • ID

  • geometry

Examples

#Activity 1, 3 and 4 are ok,
#Activity 2 has different ocean,
#Activity 5 is outside ocean and harbour,
#Activity 6 has no position
#Activity 7 has no ocean label
dataframe1 <- data.frame(activity_id = c("1", "2", "3", "4", "5", "6", "7"),
                         ocean_label = c("ocean_1", "ocean_2", "ocean_2", "ocean_2", "ocean_2",
                                         "ocean_1", NA),
                         activity_position = c("POINT (0 0)", "POINT (0 0)", "POINT (-1 -1)",
                                               "POINT (1 1)", "POINT (3 3)", NA, "POINT (1 1)"),
                         trip_id = c("1", "2", "2", "2", "2", "2", "2"))
dataframe2 <- data.frame(trip_id = c("1", "2"),
                         harbour_position_departure = c("POINT (20 20)", "POINT (-1.05 -1)"),
                         harbour_position_landing = c("POINT (20 20)", "POINT (20 20)"))
dataframe3 <- sf::st_sf(data.frame(ID = c("ocean_1", "ocean_2"),
                                   geometry = sf::st_sfc(sf::st_polygon(list(rbind(c(0,0), c(2,0),
                                                                                   c(2,2), c(0,2),
                                                                                   c(0,0)))),
                                                         sf::st_polygon(list(rbind(c(0,1), c(3,1),
                                                                                   c(3,2), c(0,2),
                                                                                   c(0,1)))),
                                                         crs = 4326)))
logbook_position_control(dataframe1, dataframe2, dataframe3, output = "report")
#> [[1]]
#>   activity_id logical                    type ocean_label ocean_calculate
#> 1           1    TRUE                     Sea     ocean_1         ocean_1
#> 2           2   FALSE                     Sea     ocean_2         ocean_1
#> 3           3    TRUE                 Harbour     ocean_2            <NA>
#> 4           4    TRUE                     Sea     ocean_2 ocean_1 ocean_2
#> 5           5   FALSE Excluding shapes oceans     ocean_2            <NA>
#> 6           6   FALSE             No position     ocean_1            <NA>
#> 7           7   FALSE                     Sea        <NA> ocean_1 ocean_2
#> 
#> [[2]]
#>   activity_id activity_position logical_harbour logical_ocean logical
#> 1           1       POINT (0 0)           FALSE          TRUE    TRUE
#> 2           2       POINT (0 0)           FALSE         FALSE   FALSE
#> 3           3     POINT (-1 -1)            TRUE         FALSE    TRUE
#> 4           4       POINT (1 1)           FALSE          TRUE    TRUE
#> 5           5       POINT (3 3)           FALSE         FALSE   FALSE
#> 6           6              <NA>           FALSE         FALSE   FALSE
#> 7           7       POINT (1 1)           FALSE         FALSE   FALSE
#>                      type ocean_label ocean_calculate activity_crs
#> 1                     Sea     ocean_1         ocean_1         4326
#> 2                     Sea     ocean_2         ocean_1         4326
#> 3                 Harbour     ocean_2            <NA>         4326
#> 4                     Sea     ocean_2 ocean_1 ocean_2         4326
#> 5 Excluding shapes oceans     ocean_2            <NA>         4326
#> 6             No position     ocean_1            <NA>         4326
#> 7                     Sea        <NA> ocean_1 ocean_2         4326
#>