Check if duration is outside of a range
check_duration.Rd
Check if value is strictly inferior of the lower threshold or strictly superior of the higher threshold.
Usage
check_duration(
dataset,
column_to_check,
uuid_column = "uuid",
log_name = "duration_log",
lower_bound = 25,
higher_bound = 90
)
Arguments
- dataset
a dataset to be check as a dataframe or a list with the dataframe stored as "checked_dataset"
- column_to_check
string character with the name of the duration column
- uuid_column
uuid column in the dataset. Default is uuid.
- log_name
character string with name to give to the log
- lower_bound
lower value of the range (strictly inferior to)
- higher_bound
higher value of the range (strictly superior to)
Value
return a list with the dataset checked stored as checked_dataset and a dataframe with the duration log
Examples
testdata <- data.frame(
uuid = c(letters[1:7]),
duration_audit_start_end_ms = c(
2475353, 375491, 2654267, 311585, 817270,
2789505, 8642007
),
duration_audit_start_end_minutes = c(41, 6, 44, 5, 14, 46, 144)
)
check_duration(testdata,
column_to_check = "duration_audit_start_end_minutes") |>
knitr::kable()
#>
#>
#> |uuid | duration_audit_start_end_ms| duration_audit_start_end_minutes|
#> |:----|---------------------------:|--------------------------------:|
#> |a | 2475353| 41|
#> |b | 375491| 6|
#> |c | 2654267| 44|
#> |d | 311585| 5|
#> |e | 817270| 14|
#> |f | 2789505| 46|
#> |g | 8642007| 144|
#>
#> |uuid | old_value|question |issue |
#> |:----|---------:|:--------------------------------|:-----------------------------------------------|
#> |b | 6|duration_audit_start_end_minutes |Duration is lower or higher than the thresholds |
#> |d | 5|duration_audit_start_end_minutes |Duration is lower or higher than the thresholds |
#> |e | 14|duration_audit_start_end_minutes |Duration is lower or higher than the thresholds |
#> |g | 144|duration_audit_start_end_minutes |Duration is lower or higher than the thresholds |
check_duration( testdata,
column_to_check = "duration_audit_start_end_ms",
lower_bound = 375490,
higher_bound = 8642000) |>
knitr::kable()
#>
#>
#> |uuid | duration_audit_start_end_ms| duration_audit_start_end_minutes|
#> |:----|---------------------------:|--------------------------------:|
#> |a | 2475353| 41|
#> |b | 375491| 6|
#> |c | 2654267| 44|
#> |d | 311585| 5|
#> |e | 817270| 14|
#> |f | 2789505| 46|
#> |g | 8642007| 144|
#>
#> |uuid | old_value|question |issue |
#> |:----|---------:|:---------------------------|:-----------------------------------------------|
#> |d | 311585|duration_audit_start_end_ms |Duration is lower or higher than the thresholds |
#> |g | 8642007|duration_audit_start_end_ms |Duration is lower or higher than the thresholds |
testdata %>%
check_duration(column_to_check = "duration_audit_start_end_minutes") %>%
check_duration( column_to_check = "duration_audit_start_end_ms",
log_name = "duration_in_ms",
lower_bound = 375490,
higher_bound = 8642000 )|>
knitr::kable()
#>
#>
#> |uuid | duration_audit_start_end_ms| duration_audit_start_end_minutes|
#> |:----|---------------------------:|--------------------------------:|
#> |a | 2475353| 41|
#> |b | 375491| 6|
#> |c | 2654267| 44|
#> |d | 311585| 5|
#> |e | 817270| 14|
#> |f | 2789505| 46|
#> |g | 8642007| 144|
#>
#> |uuid | old_value|question |issue |
#> |:----|---------:|:--------------------------------|:-----------------------------------------------|
#> |b | 6|duration_audit_start_end_minutes |Duration is lower or higher than the thresholds |
#> |d | 5|duration_audit_start_end_minutes |Duration is lower or higher than the thresholds |
#> |e | 14|duration_audit_start_end_minutes |Duration is lower or higher than the thresholds |
#> |g | 144|duration_audit_start_end_minutes |Duration is lower or higher than the thresholds |
#>
#> |uuid | old_value|question |issue |
#> |:----|---------:|:---------------------------|:-----------------------------------------------|
#> |d | 311585|duration_audit_start_end_ms |Duration is lower or higher than the thresholds |
#> |g | 8642007|duration_audit_start_end_ms |Duration is lower or higher than the thresholds |