all_of: Functions which return functions that can check a form input...

Description Usage Details Value Examples

View source: R/checks.R

Description

These functions return functions which can be passed to the fields list of a FormStage object. The created functions check their inputs and return NULL or an error message.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17

Details

The examples are mostly self-explanatory.

all_of checks each of the functions it is passed.

Value

A function for checking a form input

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
f1 <- is_whole_number()
f1("pi", 3.141)
is_one_of(1:3)("The variable", 3)
is_one_of(1:3)("The variable", 4)
is_one_of("a", "b", 2:7)("The variable", 1)
length_between(3,5)("The string", "abcdef")
length_at_least(5)("The string", "abcd")
f1 <- all_of(is_whole_number(), is_between(3,5))
f1("The variable", 2)
f1("The variable", 2.5)
f1("The variable", 3.5)
f1("The variable", 4)

hughjonesd/betr documentation built on May 17, 2019, 9:11 p.m.