from_validator {accumulate}R Documentation

Use a validate::validator object to define a test

Description

Create a test function that accepts a data.frame, and returns TRUE when the data passes all checks defined in the validator object, and otherwise FALSE.

Usage

from_validator(v, ...)

Arguments

v

[validator] a validator object from the validate package.

...

options passed to validate::confront

Value

a function that accepts a data fram and returns TRUE when the data passes all checks in v and otherwise FALSE.

Note

Requires the validate package to be installed.

References

Mark P. J. van der Loo, Edwin de Jonge (2021). Data Validation Infrastructure for R. Journal of Statistical Software, 97(10), 1-31. doi:10.18637/jss.v097.i10

Examples


if (requireNamespace("validate", quietly=TRUE)){
 v <- validate::validator(height >= 0, weight >= 0)
 f <- from_validator(v)
 f(women)  # TRUE (all heights and weights are nonnegative)
}



[Package accumulate version 0.9.3 Index]