Learn R Programming

datapackage (version 0.2.1)

dp_check_dataresource: Check if a data set is valid given a Data Resource

Description

Check if a data set is valid given a Data Resource

Usage

dp_check_dataresource(
  x,
  dataresource = attr(x, "resource"),
  constraints = TRUE,
  throw = FALSE,
  tolerance = sqrt(.Machine$double.eps)
)

Value

Returns TRUE when the field is valid. Returns a character vector with length >= 1 if the field is not valid. The text in the character values indicates why the field is not valid.

When throw = TRUE the function will generate an error instead of returning a character vector. When the dataset is valid the function returns TRUE invisibly.

Arguments

x

data.frame to check

dataresource

dataresource object to check x against.

constraints

also check relevant constraints in the field descriptor.

throw

generate an error if the data set is not valid according to the dataresource.

tolerance

numerical tolerance used in some of the tests

See Also

Use isTRUE to check if the test was successful. See dp_check_field for a function that checks a column or vector.