Identifies in the observer data all the species with an inconsistent fate according to their species group.

obs_catch_or_sample_fate_by_species_group_control(data)

Arguments

data

data.frame expected. All catches or samples 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

  • speciesfate_code

  • species_faocode

  • speciesgroup_label

Or

  • samplemeasure_id

  • speciesfate_code

  • species_faocode

  • speciesgroup_label

Note

Version 1.0

Author

Chloé Tellier, Philippe S. Sabarros

Examples

#Catch 1 is ok: the catch is a whale and its fate is code 1,
#Catch 2 is not ok: the catch is a bycatch and its fate is code 2,
#Catch 3 is not ok: the catch is a whale and its fate is code 4,
#Catch 4 is ok: the catch is a major tuna and its fate is code 6,
#Catch 5 is not ok: the catch is a bycatch and its fate is code 6,
#Catch 6 is ok: the catch is a minor tuna and its fate is code 15,
#Catch 7 is not ok: the catch is a major tuna and is fate is code 15,
#Catch 8 is not ok: the catch is a bycatch and its fate is code 10.
catch <- data.frame(catch_id = c("1", "2", "3", "4", "5", "6", "7", "8"),
                    speciesfate_code = c("1", "2", "4", "6", "6", "15", "15", "10"),
                    species_faocode = c("MYS", "ALM", "MYS", "YFT", "CNT", "LTA", "BET", "MOP"),
                    speciesgroup_label = c("Cetaceans", "Other bony fishes",
                                             "Cetaceans", "Tunas nei", "Other bony fishes",
                                            "Tunas nei", "Tunas nei", "Other bony fishes"))
obs_catch_or_sample_fate_by_species_group_control(catch)
#>   catch_id speciesfate_code species_faocode speciesgroup_label logical
#> 1        1                1             MYS          Cetaceans    TRUE
#> 2        2                2             ALM  Other bony fishes   FALSE
#> 3        3                4             MYS          Cetaceans   FALSE
#> 4        4                6             YFT          Tunas nei    TRUE
#> 5        5                6             CNT  Other bony fishes   FALSE
#> 6        6               15             LTA          Tunas nei    TRUE
#> 7        7               15             BET          Tunas nei   FALSE
#> 8        8               10             MOP  Other bony fishes   FALSE