View source: R/11.0-core-validators.R
| validate_fraction | R Documentation |
Specialized validator for fraction/proportion values.
validate_fraction(
value,
param_name,
strategy = "strict",
allow_zero = TRUE,
allow_one = TRUE
)
value |
Value(s) to validate |
param_name |
Parameter name |
strategy |
Handling strategy |
allow_zero |
Whether zero is allowed |
allow_one |
Whether one is allowed |
An object of class fb4_validation (see
validation_result). valid is TRUE when all
values lie within [0, 1] (or the bounds set by allow_zero
and allow_one). Out-of-range values are recorded in
errors (strategy "strict") or warnings
(strategy "warn").
validate_fraction(0.5, "diet_proportion")
validate_fraction(c(0.3, 0.7), "fractions")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.