R/obs_sample_round_size_control.R
obs_sample_round_size_control.RdThis function controls the accuracy (decimals) of size samples. Returns samples with decimal values that are not rounded to the inferior centimeter (or to the nearest half centimeter for PD1 measurements).
obs_sample_round_size_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
sample_length
sizetype_code
Version 1.0
#Sample 1 is ok: the size type is TL and the length is rounded to .0
#Sample 2 is ok: the size type is PD1 and the length is rounded to.5
#Sample 3 is not ok: the size type is TL and the length is not rounded to .0
#Sample 4 is not ok: the size type is PD1 and the length is not rounded to .5
sample <- data.frame(samplemeasure_id = c("1", "2", "3", "4"),
sample_length = c("112", "35.5", "119.3", "43.7"),
sizetype_code = c("TL", "PD1", "TL", "PD1"))
obs_sample_round_size_control(sample)
#> samplemeasure_id sample_length sizetype_code logical
#> 1 1 112 TL TRUE
#> 2 2 35.5 PD1 TRUE
#> 3 3 119.3 TL FALSE
#> 4 4 43.7 PD1 FALSE