Learn R Programming

interfacer (version 0.3.3)

type.in_range: Define a conformance rule to confirm that a numeric is in a set range

Description

This is anticipated to be part of a iface rule e.g.

Usage

type.in_range(min, max, include.min = TRUE, include.max = TRUE)

Value

a function which checks the values and returns them if OK or throws an error if not

Arguments

min

the lower limit

max

the upper limit

include.min

is lower limit open (default TRUE)

include.max

is upper limit open (default TRUE)

Details

iface(test_col = integer + in_range(-10,10) ~ "An integer from -10 to 10")

Examples

Run this code
type.in_range(0,10,TRUE,TRUE)(0:10)
try(type.in_range(0,10,TRUE,FALSE)(0:10))
try(type.in_range(0,10,FALSE)(0:10))
type.in_range(0,10,FALSE,TRUE)(1:10)
type.in_range(0,10,TRUE,FALSE)(0:9)
type.in_range(0,Inf,FALSE,FALSE)(1:9)
try(type.in_range(0,10)(1:99))

Run the code above in your browser using DataLab