A wrapper around validated_reactive_val()
that uses stbl::stabilize_dbl()
to validate and coerce its value. This is a convenience function that
constructs the validation_expr
for you.
Usage
vrv_dbl(
value = NULL,
default = NULL,
allow_null = TRUE,
allow_na = TRUE,
min_size = NULL,
max_size = NULL,
coerce_character = TRUE,
coerce_factor = TRUE,
min_value = NULL,
max_value = NULL,
label = NULL,
env = rlang::caller_env()
)
vrv_dbl_scalar(
value = NULL,
default = NULL,
label = NULL,
allow_null = TRUE,
allow_zero_length = TRUE,
allow_na = TRUE,
coerce_character = TRUE,
coerce_factor = TRUE,
min_value = NULL,
max_value = NULL,
env = rlang::caller_env()
)
Arguments
- value
(various) The initial value. This value will be coerced via the validation expression when accessed. If this value is reactive, an observer with
priority = Inf
will be created to attempt to keep the validated value in sync with that reactive.- default
(various, including
expression
orreactive expression
) A value to use when the current value is not valid according to the defined rules. Defaults toNULL
.- allow_null
(length-1
logical
,expression
, orreactive expression
) IsNULL
an acceptable value?- allow_na
(length-1
logical
,expression
, orreactive expression
) AreNA
values okay?- min_size
(length-1
integer
,expression
, orreactive expression
) The minimum size of the vector.- max_size
(length-1
integer
,expression
, orreactive expression
) The maximum size of the vector.- coerce_character
(length-1
logical
,expression
, orreactive expression
) Should character vectors such as"1"
and"2.0"
be coerced to double?- coerce_factor
(length-1
logical
,expression
, orreactive expression
) Should factors with values such as"1"
and"2.0"
be coerced to double? Note that this function uses the character value from the factor, whileas.double()
uses the integer index of the factor.- min_value
(length-1
double
,expression
, orreactive expression
, orNULL
) The lowest allowed value forx
. IfNULL
(default) values are not checked.- max_value
(length-1
double
,expression
, orreactive expression
, orNULL
) The highest allowed value forx
. IfNULL
(default) values are not checked.- label
(length-1
character
orNULL
) An optional label for thevalidated_reactive_value
, used for debugging.- env
(
environment
) The environment in which to evaluate thevalidation_expr
.- allow_zero_length
(length-1
logical
,expression
, orreactive expression
) Is a zero-length vector acceptable?