compare(model, comparison, equal = TRUE, coerce = allowAll, shorten = allowAll, ignoreOrder = allowAll, ignoreNameCase = allowAll, ignoreNames = allowAll, ignoreAttrs = allowAll, round = FALSE, ignoreCase = allowAll, trim = allowAll, dropLevels = allowAll, ignoreLevelOrder = allowAll, ignoreDimOrder = allowAll, ignoreColOrder = allowAll, ignoreComponentOrder = allowAll, colsOnly = !allowAll, allowAll = FALSE)
compareName(model, compName, ..., ignore.case = TRUE, compEnv = .GlobalEnv)
model
. compare()
."comparison"
.This is a list. The most important components are result
,
which gives the overall success/failure of the comparison,
and transform
, which describes the transformations
attempted during the comparison (whether they were successful or not).
compare()
function compares two objects for equality.
The arguments
allow for various transformations of the objects (e.g., type
coercion) in order to try and achieve equality.
Specific transformations can be turned on via the appropriate
argument, or the allowAll
argument can be used to
enable all transformations, with the exception of
rounding of numeric values. The compareName()
function is a wrapper for compare()
that requires the name of the comparison object rather than
the objects itself, plus it allows an environment to be supplied
that contains the actual comparison object. This is useful for the
situation where a particular object with a particular name should have
been generated and allows the generated object to differ from the
desired object in terms of the case of its name.
comparison-class
and
compareEqual
obj1 <- c("a", "a", "b", "c")
obj2 <- factor(obj1)
compare(obj1, obj2, allowAll=TRUE)
Run the code above in your browser using DataLab