Identifies in the observer data any inconsistencies between observed systems and species caught.

obs_activity_observed_systems_control(catch, observedsystem)

Arguments

catch

data.frame expected. All catches during the time range selected.

observedsystem

data.frame expected. All observed systems for activities during the time range selected.

Value

The function returns one data.frame.

Details

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

  • catch_id

  • activity_id

  • species_faocode

  • activity_id

  • observedsystem_id

  • observedsystem_code

Note

Version 1.0

Author

Chloé Tellier, Philippe S. Sabarros

Examples

#Catch 1 is ok: there is a whale shark in the catches, and a whale shark in the observed systems.
#Catch 2 is ok: there is a whale in the catches, and a whale in the observed systems.
#Catch 3 is ok: there is no whale or whale shark in the catches, and no whale or whale shark in the
#                observed systems.
#Catch 4 is not ok: there is a whale in the catches, but not in the observed systems.
#Catch 5 is not ok: there is a whale shark in the observed systems, but not in the catches.
catch <- data.frame(catch_id = c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"),
                   activity_id = c("1", "1", "1", "2", "2", "2", "3", "3", "4", "4", "4", "5"),
                   species_faocode = c("RHN", "SKJ", "BLT", "MYS", "YFT", "BET", "SKJ", "YFT",
                                       "SKJ", "MYS", "BUM", "YFT"))
observedsystem <- data.frame(activity_id = c("1", "2", "3", "4", "5"),
                             observedsystem_id = c("1", "2", "3", "4", "5"),
                             observedsystem_code = c("22", "112", "0", "0", "21"))
obs_activity_observed_systems_control(catch, observedsystem)
#> # A tibble: 5 × 4
#>   activity_id species_faocode observedsystem_code logical
#>   <chr>       <chr>           <chr>               <lgl>  
#> 1 1           RHN, SKJ, BLT   22                  TRUE   
#> 2 2           MYS, YFT, BET   112                 TRUE   
#> 3 3           SKJ, YFT        0                   TRUE   
#> 4 4           SKJ, MYS, BUM   0                   FALSE  
#> 5 5           YFT             21                  FALSE