powered by
Specialized validator for fraction/proportion values.
validate_fraction( value, param_name, strategy = "strict", allow_zero = TRUE, allow_one = TRUE )
An object of class fb4_validation (see
fb4_validation
validation_result). valid is TRUE when all values lie within \([0, 1]\) (or the bounds set by allow_zero
validation_result
valid
TRUE
allow_zero
and allow_one). Out-of-range values are recorded in
allow_one
errors (strategy "strict") or warnings
errors
"strict"
warnings
(strategy "warn").
"warn"
Value(s) to validate
Parameter name
Handling strategy
Whether zero is allowed
Whether one is allowed
validate_fraction(0.5, "diet_proportion") validate_fraction(c(0.3, 0.7), "fractions")
Run the code above in your browser using DataLab