vector_values_between: Checks if the values in the vector are between specified min...

View source: R/real_vector.R

vector_values_betweenR Documentation

Checks if the values in the vector are between specified min and max values.

Description

The interval by default is intended as inclusive [min, max].

Usage

vector_values_between(
  v,
  min,
  max,
  inclusive_min = TRUE,
  inclusive_max = TRUE,
  allow_na_values = FALSE
)

Arguments

v

The vector to check.

min

The minimum allowed value for each vector element, inclusive or exclusive. -Inf is accepted.

max

The maximum allowed value for each vector element, inclusive or exclusive. Inf is accepted.

inclusive_min

If TRUE (default) the min value is checked inclusive. If FALSE, the min value will be checked exclusive.

inclusive_max

If TRUE (default) the max value is checked inclusive. If FALSE, the max value will be checked exclusive.

allow_na_values

If TRUE, accept (and disregard) values that are NA. Default FALSE.

Examples

## Not run: 
# For assertion
assertthat::assert_that(qscheck::vector_values_between(vec, 3, 5))
# For check
if (qscheck::vector_values_between(vec, 3, 5)) {}

## End(Not run)


AstraZeneca/qscheck documentation built on Nov. 1, 2023, 4:45 a.m.