Class definition of 'RAVE' constrained variable
Source:R/class-variable-constraint.R
RAVEVariable.RdSee new_constrained_variable for constructor function.
Value
Formatted characters
Self instance
Self
Current value
TRUE if valid, otherwise returns the error message
A list of constraint data that can be passed into
$restore method
RAVEVariable instance
Active bindings
constraintsinstance of
RAVEVariableConstraints, used to validate the inputisRAVEVariablealways true
typeconstraint type
valuevalue of the variable
initializedwhether value is missing (value might not be valid)
generatorclass definition
Methods
Method format()
Format method
Method use_constraints()
Set variable validation
Arguments
constraintseither a
character(1)or aRAVEVariableConstraintsinstance. Whenconstraintsis a string, the value will be thetypeof the constraint ( seenew_constraints).i, ...used when
constraintsis a string, either.iis an expression, orlist(.i,...)forms a list of control parameters; seeassertionsinnew_constraints.
Method set_value()
Set value
Usage
RAVEVariable$set_value(
x,
env = parent.frame(),
validate = TRUE,
on_error = NULL
)Arguments
xvalue of the variable
envenvironment in which the validations will be evaluated
validatewhether to validate if
xis legit; if set toTRUEandxis invalid, then the values will not be set.on_errora function takes two arguments: the error instance and old value; the returned value will be used to re-validate. Default is
NULL, which is identical to returning the old value and stop on error.
Method validate()
Check if the value is valid
Usage
RAVEVariable$validate(
env = parent.frame(),
on_error = c("error", "warning", "message", "muffle")
)Method check()
Check if the value is valid with no error raised
Usage
RAVEVariable$check(env = parent.frame())Method restore()
Restores from atomic list generated by $store()
Usage
RAVEVariable$restore(x, env = parent.frame(), ...)