check.notnull: Check not-null constraints

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/check.notnull.r

Description

Check for violation of a not-null constraint

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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 March 4, 2020, 4:50 p.m.