R/logbook_anapo_activity_control.R
logbook_anapo_activity_control.Rd
The purpose of the logbook_anapo_activity_control function is to provide a table of data that contains an inconsistency between the VMS and the presence of activit
logbook_anapo_activity_control(
dataframe1,
dataframe2,
output,
vessel_type = c("1", "2", "5", "6", "10")
)
data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_anapo_activity_control function.
data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_anapo_activity_control function.
character expected.Kind of expected output. You can choose between "message", "report" or "logical".
character expected. Default values: c("1", "2", "5", "6", "10"). List of vessel type code to be inspected
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 :
vms_id
vms_date
vessel_code
vms_codevessel
vessel_type
activity_id
activity_date
vessel_code
#VMS 1, 3, 4 and 5 are ok,
#VMS 2 has not linked to an activity
dataframe1 <- data.frame(vms_id = c("1", "2", "3", "4", "5"),
vms_date = as.Date(c("2020/01/01", "2020/01/02", "2020/02/02",
"2020/02/02", "2020/02/03")),
vessel_code = c("1", "1", "2", "3", "4"),
vms_codevessel = c("vessel_1", "vessel_1", "vessel_2", "vessel_2",
"vessel_4"),
vessel_type = c("1", "1", "1", "1", "3"))
dataframe2 <- data.frame(activity_id = c("1", "2"),
activity_date = as.Date(c("2020/01/01", "2020/02/02")),
vessel_code = c("1", "2"))
logbook_anapo_activity_control(dataframe1, dataframe2, output = "report")
#> vms_id vessel_code vms_date vms_codevessel vessel_type logical nb_activity
#> 1 1 1 2020-01-01 vessel_1 1 TRUE 1
#> 2 2 1 2020-01-02 vessel_1 1 FALSE 0
#> 3 3 2 2020-02-02 vessel_2 1 TRUE 1
#> 4 4 3 2020-02-02 vessel_2 1 TRUE 0
#> 5 5 4 2020-02-03 vessel_4 3 TRUE 0