Use these function to determine the validity of a stw_dict or stw_meta object; stw_check() tells you about the object, stw_validate() additionally throws an error if warranted. To support piping, these functions return their first argument invisibly.

stw_check(...)

# S3 method for default
stw_check(...)

# S3 method for stw_dict
stw_check(dict, verbosity = c("error", "info", "all", "none"), ...)

# S3 method for stw_meta
stw_check(meta, verbosity = c("error", "info", "all", "none"), ...)

# S3 method for stw_dataset
stw_check(dataset, verbosity = c("error", "info", "all"), ...)

stw_validate(...)

# S3 method for default
stw_validate(...)

# S3 method for stw_dict
stw_validate(dict, verbosity = c("error", "info", "all"), ...)

# S3 method for stw_meta
stw_validate(meta, verbosity = c("error", "info", "all"), ...)

# S3 method for stw_dataset
stw_validate(dataset, verbosity = c("error", "info", "all"), ...)

Arguments

...

other arguments (not used)

dict

Object with S3 class stw_dict, contains data-dictionary

verbosity

character, determines the amount of feedback, see Details.

meta

Object with S3 class stw_meta, contains meta-data

dataset

Object with S3 class stw_dataset, a data frame with attached meta-data

Value

modified copy of dict or meta

Details

You can specify the verbosity:

"error"

reports results of all checks that failed

"info"

reports results of all checks that failed, and that find missing optional information

"all"

reports results of all checks

"none"

reports no results

The "none" option may not seem intuitive, it is for internal use. These functions set an internal attribute of the object to inicate its validity.

For a stw_dict object, each name nust be unique and non-trivial, each description must be non-trivial, type is optional.

For a stw_meta object, it must have a non-trivial name, and dict. It may have a title, description, source, n_row, and n_col.

Examples

stw_check(diamonds_meta$dict)