check.notnull: Check not-null constraints

View source: R/check.notnull.r

check.notnullR Documentation

Check not-null constraints

Description

Check for violation of a not-null constraint

Usage

check.notnull(x, cols, silent = FALSE)

Arguments

x

Data frame representing a table of a data base.

cols

Names of the colum(s) of x which are to be scanned for missing values (vector of type character).

silent

Logical. If FALSE, details on constraint violations are shown using print.

Value

TRUE if the check was passed successfully and FALSE otherwise.

Note

The function tests for the occurrence of NA in any of the columns of x specified in cols. Hence, it is assumed that missing values are marked as NA (instead of NULL like in a true SQL data base).

Author(s)

David Kneis david.kneis@tu-dresden.de

See Also

There are more functions to check constraints, namely check.unique, check.key, and check.link. See also the example for db.read.

Examples


data(temperature)
print(temperature)

# Should succeed
check.notnull(temperature, c("day", "city"))

# Example of NA
temperature[2, "day"] <- NA
print(temperature)
check.notnull(temperature, c("day", "city"))

dkneis/tabular documentation built on Feb. 9, 2023, 12:34 a.m.