prop_float: Numeric (floating-point) S7 property

View source: R/02_S7_prop_factories.R

prop_floatR Documentation

Numeric (floating-point) S7 property

Description

The one factory whose name differs from its JSON Schema type: it emits type "number" (which in JSON Schema includes integers), but is named prop_float because declarers think in the integer/float pairing – "number" next to prop_integer invites the same ambiguity as R's "numeric". Accepts R integer values too (class_numeric), floats being a superset of integers.

Usage

prop_float(
  default = NULL,
  min = NULL,
  max = NULL,
  exclusive_min = NULL,
  exclusive_max = NULL,
  nullable = FALSE,
  vector = FALSE,
  min_items = 1L,
  unique_items = FALSE,
  description = ""
)

Arguments

default

Numeric: Default value (NULL for none, or if nullable).

min, max

Numeric or NULL: Inclusive bounds.

exclusive_min, exclusive_max

Numeric or NULL: Exclusive bounds.

nullable

Logical: If TRUE, NULL is a valid value.

vector

Logical: If TRUE, the value is vector-valued (a JSON array).

min_items

Integer: Fewest elements a vector value may hold.

unique_items

Logical: If TRUE, a vector value's elements must be distinct.

description

Character: Human-readable description.

Value

S7 property.

Author(s)

EDG

Examples

# Sampling temperature in [0, 2]
temperature <- prop_float(default = 0.3, min = 0, max = 2)
# Learning rate in (0, 1]
lr <- prop_float(default = 0.1, exclusive_min = 0, max = 1)

rtemis.core documentation built on Sept. 20, 2026, 9:06 a.m.