R/obs_activity_more_samples_than_catches_control.R
obs_activity_more_samples_than_catches_control.RdIdentifies in the observer data all the observations with a number of samples superior to the number of catches.
obs_activity_more_samples_than_catches_control(catch, sample)data.frame expected. All catches during the time range selected.
data.frame expected. All samples during the time range selected.
The function returns one data.frame.
The input dataframes must contain all these columns for the function to work :
catch_id
activity_id
species_faocode
speciesfate_code
catch_count
samplemeasure_id
activity_id
species_faocode
speciesfate_code
sample_count
Version 1.0
#Activity 1 is ok: there is 2 catches and 1 samples,
#Activity 2 is ok: there is 2 catches and 2 samples,
#Activity 3 is not ok: there is 1 catch but 2 samples.
catch <- data.frame(catch_id = c("1", "2", "3", "4"),
activity_id = c("1", "2", "2", "3"),
species_faocode = c("BLT", "FAL", "FAL", "CNT"),
speciesfate_code = c("15", "4", "4", "5"),
catch_count = c("2", "1", "1", "1"))
sample <- data.frame(samplemeasure_id = c("1", "2", "3", "4"),
activity_id = c("1", "2", "2", "3"),
species_faocode = c("BLT", "FAL", "FAL", "CNT"),
speciesfate_code = c("15", "4", "4", "5"),
sample_count = c("1", "1", "1", "2"))
obs_activity_more_samples_than_catches_control(catch, sample)
#> # A tibble: 3 × 6
#> activity_id species_faocode speciesfate_code nb_catch nb_measure logical
#> <chr> <chr> <chr> <dbl> <dbl> <lgl>
#> 1 1 BLT 15 2 1 TRUE
#> 2 2 FAL 4 2 2 TRUE
#> 3 3 CNT 5 1 2 FALSE