Is the input in range?
Usage
isInRange(x, lower = -Inf, upper = Inf, closed = c(TRUE, TRUE))
isInClosedRange(x, lower = -Inf, upper = Inf)
isInOpenRange(x, lower = -Inf, upper = Inf)
isInLeftOpenRange(x, lower = -Inf, upper = Inf)
isInRightOpenRange(x, lower = -Inf, upper = Inf)
isNegative(x)
isPositive(x)
isNonNegative(x)
isNonPositive(x)
isPercentage(x)
isProportion(x)
allAreInRange(x, lower = -Inf, upper = Inf, closed = c(TRUE, TRUE))
allAreInClosedRange(x, lower = -Inf, upper = Inf)
allAreInOpenRange(x, lower = -Inf, upper = Inf)
allAreInLeftOpenRange(x, lower = -Inf, upper = Inf)
allAreInRightOpenRange(x, lower = -Inf, upper = Inf)
allAreNegative(x)
allArePositive(x)
allAreNonNegative(x)
allAreNonPositive(x)
allArePercentage(x)
allAreProportion(x)
Arguments
- x
Object.
- lower
numeric(1)
. Lower boundary.- upper
numeric(1)
. Upper boundary.- closed
logical(2)
. Should the lower (1) and upper (2) bounaries be closed?
Functions
isInRange()
: Vectorized.isInClosedRange()
: Vectorized.isInOpenRange()
: Vectorized.isInLeftOpenRange()
: Vectorized.isInRightOpenRange()
: Vectorized.isNegative()
: Vectorized.isPositive()
: Vectorized.isNonNegative()
: Vectorized.isNonPositive()
: Vectorized.isPercentage()
: Vectorized.isProportion()
: Vectorized.allAreInRange()
: Scalar.allAreInClosedRange()
: Scalar.allAreInOpenRange()
: Scalar.allAreInLeftOpenRange()
: Scalar.allAreInRightOpenRange()
: Scalar.allAreNegative()
: Scalar.allArePositive()
: Scalar.allAreNonNegative()
: Scalar.allAreNonPositive()
: Scalar.allArePercentage()
: Scalar.allAreProportion()
: Scalar.
Intervals
Closed: Includes all its limit points, and is denoted with square brackets. For example,
[0,1]
means greater than or equal to 0 and less than or equal to 1.Open: Does not include its endpoints, and is indicated with parentheses. For example,
(0,1)
means greater than 0 and less than 1.
See also
assertive.numbers::is_in_range()
.assertive.numbers::is_in_closed_range()
.assertive.numbers::is_in_open_range()
.assertive.numbers::is_in_left_open_range()
.assertive.numbers::is_in_right_open_range()
.assertive.numbers::is_negative()
.assertive.numbers::is_positive()
.assertive.numbers::is_non_negative()
.assertive.numbers::is_non_positive()
.assertive.numbers::is_percentage()
.assertive.numbers::is_proportion()
.
Examples
## TRUE ====
isInRange(0, lower = 0, upper = 1)
#> [1] TRUE
isInRange(1, lower = 0, upper = 1)
#> [1] TRUE
isInClosedRange(1, lower = 0, upper = 1)
#> [1] TRUE
isInOpenRange(0.5, lower = 0, upper = 1)
#> [1] TRUE
isInLeftOpenRange(1, lower = 0, upper = 1)
#> [1] TRUE
isInRightOpenRange(0, lower = 0, upper = 1)
#> [1] TRUE
isNegative(c(-2, -1))
#> [1] TRUE TRUE
isPositive(c(1, 2))
#> [1] TRUE TRUE
isNonNegative(c(0, 1))
#> [1] TRUE TRUE
isNonPositive(c(-1, 0))
#> [1] TRUE TRUE
isPercentage(c(0, 25, 50, 100))
#> [1] TRUE TRUE TRUE TRUE
isProportion(c(0, 0.01, 0.1, 1))
#> [1] TRUE TRUE TRUE TRUE
## FALSE ====
isInRange(c(-1, 2), lower = 0, upper = 1)
#> [1] FALSE FALSE
isInClosedRange(c(0, 1), lower = 0, upper = 1)
#> [1] TRUE TRUE
isInOpenRange(c(1, 2), lower = 0, upper = 1)
#> [1] FALSE FALSE
isInLeftOpenRange(0, lower = 0)
#> [1] FALSE
isInRightOpenRange(1, upper = 1)
#> [1] FALSE
isPositive(-1)
#> [1] FALSE
isNegative(1)
#> [1] FALSE
isPercentage(110)
#> [1] FALSE
isProportion(1.1)
#> [1] FALSE