Learn R Programming

accumulate (version 1.0.0)

from_validator: 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, ...)

Value

a function that accepts a data fram and returns TRUE

when the data passes all checks in v and otherwise

FALSE.

Arguments

v

[validator] a validator object from the validate package.

...

options passed to validate::confront

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

Run this code

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)
}


Run the code above in your browser using DataLab