grapes-matches-grapes-.data.frame: Check Whether Data Frame matches Spec

%matches%.data.frameR Documentation

Check Whether Data Frame matches Spec

Description

Checks whether data.frame matches spec. Column names, count, and order are enforced. Encodings are enforced (all non-missing values must be valid codes). Integer and numeric ranges are enforced. Values of required are parsed and evaluated in data context: Where TRUE, the corresponding data value for column cannot be missing.

Usage

## S3 method for class 'data.frame'
x %matches% y, ...

Arguments

x

spec

y

coerced to spec (spec object or filepath for spec file).

...

passed arguments

Value

logical; TRUE if all checks above are enforceable.

See Also

Other matches: %matches%.character(), %matches%.spec(), %matches%()

Examples

data(drug)
file <- tempfile()
spec <- specification(drug, tol = 3)
write.spec(spec, file = file)
drug %matches% spec

bergsmat/spec documentation built on Feb. 21, 2024, 1:20 p.m.