check-vector-isInRange: Is the input in range?

check-vector-isInRangeR Documentation

Is the input in range?

Description

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?

Value

TRUE on success; FALSE on failure, with cause set.

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.

Note

Updated 2023-09-29.

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)
isInRange(1, lower = 0, upper = 1)
isInClosedRange(1, lower = 0, upper = 1)

isInOpenRange(0.5, lower = 0, upper = 1)
isInLeftOpenRange(1, lower = 0, upper = 1)
isInRightOpenRange(0, lower = 0, upper = 1)

isNegative(c(-2, -1))
isPositive(c(1, 2))

isNonNegative(c(0, 1))
isNonPositive(c(-1, 0))

isPercentage(c(0, 25, 50, 100))
isProportion(c(0, 0.01, 0.1, 1))

## FALSE ====
isInRange(c(-1, 2), lower = 0, upper = 1)
isInClosedRange(c(0, 1), lower = 0, upper = 1)

isInOpenRange(c(1, 2), lower = 0, upper = 1)
isInLeftOpenRange(0, lower = 0)
isInRightOpenRange(1, upper = 1)

isPositive(-1)
isNegative(1)

isPercentage(110)
isProportion(1.1)

acidgenomics/r-goalie documentation built on Jan. 12, 2024, 4:15 a.m.