This function aims to check the coherence of the sex of a sample according to the possibility of sexing this species.
obs_sample_sex_control(sample)data.frame expected. All samples during the time range selected.
The function returns one data.frame.
The input dataframe must contain all these columns for the function to work :
samplemeasure_id
sex_label
species_faocode
speciesgroup_label
Version 1.0
#Sample 1 is ok: the sample is not sexed
#Sample 2 is ok: the sample is sexed and is a DOL
#Sample 3 is ok: the sample is sexed and is a shark
#Sample 4 is not ok: the sample is sexed and is a CNT
sample <- data.frame(samplemeasure_id = c("1", "2", "3", "4"),
sex_label = c(NA, "Female", "Female", "Male"),
species_faocode = c("CNT", "DOL", "FAL", "CNT"),
speciesgroup_label = c("Other bony fishes",
"Other bony fishes",
"Sharks",
"Other bony fishes"))
obs_sample_sex_control(sample)
#> samplemeasure_id sex_label species_faocode speciesgroup_label logical
#> 1 1 <NA> CNT Other bony fishes TRUE
#> 2 2 Female DOL Other bony fishes TRUE
#> 3 3 Female FAL Sharks TRUE
#> 4 4 Male CNT Other bony fishes FALSE