Skip to contents

A double: a finite number within the bounds. infinite = TRUE admits the infinities that the bounds do not exclude, so that type_double(min = 0, infinite = TRUE) is [0, Inf]. nan = TRUE admits NaN, the result of a calculation that is undefined, which is in no range: type_double(min = 0, max = 1, nan = TRUE) is [0, 1] or NaN. A missing value, NA, is admitted by option(), as of every type.

Usage

type_double(
  min = NULL,
  max = NULL,
  exclusive_min = NULL,
  exclusive_max = NULL,
  infinite = FALSE,
  nan = FALSE,
  values = NULL
)

Arguments

min

Optional Numeric: Smallest admitted value.

max

Optional Numeric: Largest admitted value.

exclusive_min

Optional Numeric: The value must be above it. Given with min, it raises r8_declaration_error.

exclusive_max

Optional Numeric: The value must be below it. Given with max, it raises r8_declaration_error.

infinite

Logical: If TRUE, admit Inf and -Inf within the bounds.

nan

Logical: If TRUE, admit NaN, whatever the bounds and values are.

values

Optional Numeric: The admitted values.

Value

An r8_field_type.

Details

A calculation on a value's field is R's and has no type. Its result is checked where it enters a field, a column, an argument, or a result that declares one.

Examples

type_double(exclusive_min = 0)
#> <r8 field type> double (0, Inf)