Skip to contents

Specialized validator for temperature values with realistic ranges.

Usage

validate_temperature(
  value,
  param_name,
  strategy = "warn",
  min_temp = -5,
  max_temp = 45
)

Arguments

value

Temperature value(s) in Celsius

param_name

Parameter name

strategy

Handling strategy

min_temp

Minimum realistic temperature (default -5°C)

max_temp

Maximum realistic temperature (default 45°C)

Value

An object of class fb4_validation (see validation_result). valid is TRUE when all values are finite and lie within [min_temp, max_temp]. Values outside the range are recorded in warnings by default (strategy = "warn").

Examples

validate_temperature(15, "water_temp")
#> $valid
#> [1] TRUE
#> 
#> $errors
#> character(0)
#> 
#> $warnings
#> character(0)
#> 
#> $info
#> character(0)
#> 
#> $level
#> [1] "combined"
#> 
#> $category
#> NULL
#> 
#> $checked_items
#> $checked_items$param_name
#> [1] "water_temp"
#> 
#> $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:07 -04"
#> 
#> attr(,"class")
#> [1] "fb4_validation"
validate_temperature(c(5, 12, 18), "temperatures")
#> $valid
#> [1] TRUE
#> 
#> $errors
#> character(0)
#> 
#> $warnings
#> character(0)
#> 
#> $info
#> character(0)
#> 
#> $level
#> [1] "combined"
#> 
#> $category
#> NULL
#> 
#> $checked_items
#> $checked_items$param_name
#> [1] "temperatures"
#> 
#> $checked_items$type
#> [1] "numeric"
#> 
#> $checked_items$length
#> [1] 3
#> 
#> $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:07 -04"
#> 
#> attr(,"class")
#> [1] "fb4_validation"