Learn R Programming

compare (version 0.2-6)

compareIgnoreNameCase: Compare Two Objects with Different Names

Description

Compare two objects for equality, ignoring the case of name attributes, or ignoring name attributes altogether, if necessary beforehand.

Usage

compareIgnoreNameCase(model, comparison, transform = character(), equal = TRUE, ...)
"compareIgnoreNameCase"(model, comparison, transform=character(), equal=TRUE, colsOnly=TRUE, ignoreColOrder=FALSE, ignoreNameCase=FALSE, ...)
compareIgnoreNames(model, comparison, transform=character(), equal=TRUE, ...)
"compareIgnoreNames"(model, comparison, transform=character(), equal=TRUE, colsOnly=TRUE, ignoreColOrder=FALSE, ignoreNameCase=FALSE, ...)

Arguments

model
The “correct” object.
comparison
The object to be compared with the model.
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
Only ignore (case of) column names (NOT row names).
ignoreColOrder
For data frames and lists, sort the columns or components by name before ignoring the case of names.
ignoreNameCase
When reordering the columns or components by name (i.e., when ignoreColOrder=TRUE), whether to ignore the case of the names.
...
Arguments passed to compareEqual().

Value

An object of class "comparison". Use isTRUE() to determine whether the comparison has succeeded.

Details

These functions are generic, with specific methods for data frames and lists.

See Also

compare and compareEqual

Examples

Run this code
model <- data.frame(x=1:26, y=letters, z=factor(letters),
                    stringsAsFactors=FALSE)
comparison <- data.frame(a=1:26, b=letters, c=factor(letters),
                         stringsAsFactors=FALSE)
compareIgnoreNames(model, comparison)

Run the code above in your browser using DataLab