View source: R/check.notnull.r
check.notnull | R Documentation |
Check for violation of a not-null constraint
check.notnull(x, cols, silent = FALSE)
x |
Data frame representing a table of a data base. |
cols |
Names of the colum(s) of |
silent |
Logical. If |
TRUE
if the check was passed successfully and
FALSE
otherwise.
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).
David Kneis david.kneis@tu-dresden.de
There are more functions to check constraints, namely
check.unique
, check.key
,
and check.link
.
See also the example for db.read
.
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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.