checks {elisr} | R Documentation |
Miscellaneous input validation
Description
A set of test functions to ensure valid input and give helpful advice if it is not.
check_df()
guarantees that x
is an appropriate
data frame for the analysis. That means: It verifies that x
has less
than two variables (a single item can't build a core), x
has column
names (used to pre-build scls
in the overlapping process), if the
column names are unique, and not of type NA
. It throws an error if
any of these requirements are not met. Additionally, it warns the user if
the provided colnames
are not unique or NA
.
check_sclvals()
tests whether x
is a two element
vector and throws an error if not. Integers are coerced to be of type
double
. Additionally, the function ensures that the first value is
smaller than the second. Remember that checking for a two element vector
implicitly secures that x
is not NULL
(because NULL
is
a logical constant of length '0').
compare_sclvals()
makes sure that the sclvals
set
with overlap()
are equal to those set with disjoint()
. It
throws an error if not.
check_mrit()
guarantees that the input is a double vector
of length one. Moreover, the function secures that the lower bound is
unique and ranges between '0' and '1' (it throws an error if not). In
addition, it warns a user pre-determining a fragment.
check_ovlp()
safeguards that x
is a character
vector of length '1'. That means, it throws an error if not. Note that
switch()
within disjoint()
and overlap()
takes care
of the input string itself. It throws an error when the given character
doesn't match any available option.
check_msdf()
guards against inputs that are not of type
'msdf'. It throws an error if not.
check_neg()
verifies that the input is a logical constant of length 1
and not a missing value (this is necessary because objects of type NA
are logical constants of length 1, too).
check_comp()
examines the correlation matrix,
cor(df)
. It complains (throws an error) if no correlation in
cor(df)
is greater than the specified mrit_min
.
Usage
check_df(x)
check_sclvals(x)
compare_sclvals(x, x_attr)
check_mrit(x)
check_ovlp(x)
check_msdf(x)
check_neg(x)
check_comp(x, mrit_min, use)
Arguments
x |
some arbitrary input to be checked. |
x_attr |
a numeric vector of length 2 indicating the start- and endpoint of a scale. |
mrit_min |
a numeric constant of length 1 to specify the marginal corrected item-total correlation. |
use |
an optional string to specify how missing values enter the
analysis. See |
Details
All functions are internal functions.
Value
All functions are called for their side effects. If there are no errors or warnings, no value is returned.