checklist: Is a formula a check formula?

checklistR Documentation

Is a formula a check formula?

Description

is_check_formula(x) checks whether x is a check formula, while is_checklist(x) checks whether x is a checklist, i.e., a list of check formulae. (Neither function verifies logical consistency of the implied checks.)

Usage

is_check_formula(x)

is_checklist(x)

Arguments

x

Object to test.

Value

is_check_formula, resp. is_checklist, returns TRUE or FALSE, according to whether x is or is not a check formula, resp. checklist.

See Also

firmly (on the specification and use of check formulae)

Examples

is_check_formula(list(~x, ~y) ~ is.numeric)  # [1] TRUE
is_check_formula("Not positive" ~ {. > 0})   # [1] TRUE

is_checklist(list(list(~x, ~y) ~ is.numeric, "Not positive" ~ {. > 0}))
# [1] TRUE

# Invalid checklists
is_checklist("Not positive" ~ {. > 0})            # [1] FALSE (not a list)
is_checklist(list(is.numeric ~ list(~ x)))        # [1] FALSE (backwards)
is_checklist(list(list(log ~ x) ~ is.character))  # [1] FALSE (invalid check item)


valaddin documentation built on Oct. 26, 2023, 1:07 a.m.