View source: R/02_S7_prop_factories.R
| prop_float | R Documentation |
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.
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 = ""
)
default |
Numeric: Default value (NULL for none, or if |
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 |
unique_items |
Logical: If TRUE, a |
description |
Character: Human-readable description. |
S7 property.
EDG
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.