Description Usage Arguments Details Value Author(s) See Also Examples
Compare two objects for equality, shortening either one if necessary beforehand.
1 2 3 4 5 6 7 | compareShorten(model, comparison, transform = character(),
equal = TRUE, ...)
## S3 method for class 'data.frame'
compareShorten(model, comparison, transform=character(),
equal=TRUE, colsOnly=TRUE,
ignoreColOrder=FALSE, ignoreNameCase=FALSE, ...)
|
model |
The “correct” object. |
comparison |
The object to be compared with the |
transform |
A character vector containing any transformations that have been performed on the objects prior to this comparison. |
equal |
Whether to test for equality if the test for identity fails. |
colsOnly |
Whether to only drop extra columns (not rows) when comparing data frames. |
ignoreColOrder |
For data frames, whether to reorder columns by name first. |
ignoreNameCase |
For data frames and lists, whether to ignore the case of names when reordering components by name. |
... |
Arguments passed to |
This function checks whether the two objects being compared are
of the same size and, if they are not, it shrinks the larger one.
Then the two objects are compared using compareIdentical()
and, if that fails and equal=TRUE
, using compareEqual()
.
This function is generic, with specific methods for arrays, matrices, tables, and data frames.
For vectors, extra elements are dropped from the longer object.
For data frames, extra columns, (and, if
colsOnly=FALSE
, extra rows) are dropped. For lists,
extra components are dropped. For arrays, extra dimensions are
dropped. For matrices, the comparison
is forced to be
two-dimensional. For tables, extra dimensions are collapsed
(using sum()
).
An object of class "comparison"
.
Use isTRUE()
to determine whether the
comparison has succeeded.
Paul Murrell
compare
and
compareEqual
1 2 3 | compareShorten(1:5, 1:10)
compareShorten(matrix(1:10, ncol=2),
array(1:100, dim=c(5, 2, 10)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.