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

View source: R/dp_check_dataresource.R

dp_check_dataresourceR Documentation

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

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

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.

See Also

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


djvanderlaan/datapackage documentation built on June 12, 2025, 2:44 a.m.