Description Usage Arguments Details Value Author(s) See Also Examples
Compare two objects and allow for various minor differences between them.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | compareEqual(model, comparison, transform = character(), ...)
## S3 method for class 'logical'
compareEqual(model, comparison, transform = character(), ...)
## S3 method for class 'numeric'
compareEqual(model, comparison, transform = character(),
round=FALSE,
...)
## S3 method for class 'character'
compareEqual(model, comparison, transform=character(),
ignoreCase=FALSE,
trim=FALSE,
...)
## S3 method for class 'factor'
compareEqual(model, comparison, transform=character(),
dropLevels=FALSE,
ignoreLevelOrder=FALSE,
...)
## S3 method for class 'matrix'
compareEqual(model, comparison, transform=character(),
ignoreDimOrder=FALSE,
...)
## S3 method for class 'array'
compareEqual(model, comparison, transform=character(),
ignoreDimOrder=FALSE,
...)
## S3 method for class 'table'
compareEqual(model, comparison, transform=character(),
ignoreDimOrder=FALSE,
...)
## S3 method for class 'data.frame'
compareEqual(model, comparison, transform=character(),
ignoreColOrder=FALSE,
ignoreNameCase=FALSE,
...,
recurseFun=compareEqual)
## S3 method for class 'list'
compareEqual(model, comparison, transform=character(),
ignoreComponentOrder=FALSE,
ignoreNameCase=FALSE,
...,
recurseFun=compareEqual)
|
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. |
round |
For numeric vectors,
whether the objects should be rounded before comparison.
If |
ignoreCase |
For character vectors, whether to ignore the case of the strings. |
trim |
For character vectors, whether to ignore leading and trailing white space. |
dropLevels |
For factors, whether to drop unused levels before the comparison. |
ignoreLevelOrder |
For factors, whether to ignore the order of levels. |
ignoreDimOrder |
For matrices, arrays, and tables, whether to reorder of the dimensions by name before the comparison. |
ignoreColOrder |
For data frames, whether to reorder the columns by name before the comparison. |
ignoreComponentOrder |
For lists, whether to reorder the components by name before the comparison. |
ignoreNameCase |
For data frames and lists, whether to ignore the case of names when reordering components by name. |
... |
Other arguments controlling the comparison. |
recurseFun |
For data frames, the function to use to compare the columns of the data frames. For lists, the function used to compare the components of the list. |
This function compares two objects for identity (using
identical()
), then if that fails and equal=TRUE
,
compares the objects for equality. The arguments allow for
various relaxations on what “equal” means.
For numeric vectors, the comparison uses all.equal()
to allow for differences in floating-point representation.
The round
argument also allows for much more lenient
comparisons. The round
argument can also be a function,
e.g., floor()
(see other examples below).
An object of class "comparison"
.
Use isTRUE()
to determine whether the
comparison has succeeded.
Paul Murrell
1 2 3 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.