See the check details below.
Usage
ys_check(
data,
spec,
verbose = FALSE,
output = tempfile(),
error_on_fail = TRUE
)
ys_check_file(data, file)
check_data(...)
check_data_file(...)Arguments
- data
a data frame
- spec
a yspec object
- verbose
logical; ifTRUE, extra messages are printed during the check- output
the name of a file or a connection for writing check results
- error_on_fail
if
FALSE, return logical check status rather than generating an error- file
the full path to a yaml specification file
- ...
arguments passed from alias function to preferred function name
Details
To pass the data check, all of the following must be true:
The (column) names in the data set must be identical to the names in the spec object.
For discrete data types (where
valuesis set), the unique values in the data set column after removing missing values must be identical to or a subset of the values given in the spec object.For continuous data types where a
rangeis given, all of the values in the data set column must be greater than the lower bound of the range and less than the upper bound of the range, inclusive, after removing missing values.
Other checks are implicit in the data specification object and are checked on load:
All column names must be less than or equal to 8 characters by default. This maximum number of characters can be overridden by setting option
ys.col.lenequal to the desired maximum.
Output can be directed to a file (see the output argument) and
more verbose output can be requested as the check proceeds by the
verbose argument.
