check_interval()
ensures that the interval is valid
(i.e., lower < upper) and that h
satisfies
h <= |upper - lower|
.
check_is_interval()
returns a logical value indicating whether the
interval is valid.
Value
check_interval()
: A list containinglower
,upper
, andh
if valid; otherwise, raises an error.check_is_interval()
: Logical value,TRUE
if the parameters form a valid interval, andFALSE
otherwise.
Examples
# Examples for check_interval()
# -----------------------------
check_interval(h = 2, lower = 1, upper = 5)
#> $lower
#> [1] 1
#>
#> $upper
#> [1] 5
#>
#> $h
#> [1] 2
#>
try(check_interval(h = 10, lower = 1, upper = 5))
#> Error in check_interval(h = 10, lower = 1, upper = 5) :
#> Expected 'h' to be less than or equal to |upper - lower| = 4 but got: h = 10
# Examples for check_is_interval()
# --------------------------------
check_is_interval(h = 2, lower = 1, upper = 5)
#> [1] TRUE
check_is_interval(h = 10, lower = 1, upper = 5)
#> [1] FALSE