Checks values and S3 class of an atomic object.
Details
To check the class simply pass a vector of the desired class.
To check that x does not include missing values pass a single non-missing value (of the correct class).
To allow it to include missing values include a missing value.
To check that it only includes missing values only pass a missing value (of the correct class).
To check the range of the values in x pass two non-missing values (as well as the missing value if required).
To check that x only includes specific values pass three or more non-missing values.
In the case of a factor if values has two or more levels
then the levels of x must be identical,
including their order, to the levels of values.
A factor with less than two levels only checks that x is a factor.
Thus factor(1) allows any factor without missing values,
factor(c(1, NA)) any factor with or without missing values and
factor(NA) any factor with all missing values.
See also
Other check:
check_data(),
check_dim(),
check_dirs(),
check_files(),
check_key(),
check_length(),
check_names()
