Skip to contents

Specialized validator for positive numeric values.

Usage

validate_positive(value, param_name, strategy = "strict", min_val = 0.001)

Arguments

value

Value(s) to validate

param_name

Parameter name

strategy

Handling strategy

min_val

Minimum positive value (default 0.001)

Value

An object of class fb4_validation (see validation_result). valid is TRUE when all values are \(\ge\) min_val. Violations are recorded in errors (strategy = "strict") or warnings (strategy = "warn").

Examples

validate_positive(5, "weight")
#> $valid
#> [1] TRUE
#> 
#> $errors
#> character(0)
#> 
#> $warnings
#> character(0)
#> 
#> $info
#> character(0)
#> 
#> $level
#> [1] "combined"
#> 
#> $category
#> NULL
#> 
#> $checked_items
#> $checked_items$param_name
#> [1] "weight"
#> 
#> $checked_items$type
#> [1] "numeric"
#> 
#> $checked_items$length
#> [1] 1
#> 
#> $checked_items$has_na
#> [1] FALSE
#> 
#> $checked_items$has_infinite
#> [1] FALSE
#> 
#> $checked_items$range_checked
#> [1] TRUE
#> 
#> 
#> $timestamp
#> [1] "2026-06-10 23:21:02 -04"
#> 
#> attr(,"class")
#> [1] "fb4_validation"
validate_positive(0, "weight")$valid
#> [1] FALSE