compareIgnoreNameCase {compare}R Documentation

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, ...)

## S3 method for class 'data.frame':
compareIgnoreNameCase(model, comparison, transform=character(),
                      equal=TRUE, 
                      colsOnly=TRUE,
                      ignoreColOrder=FALSE,
                      ignoreNameCase=FALSE,
                      ...)

compareIgnoreNames(model, comparison, transform=character(),
                   equal=TRUE, ...) 

## S3 method for class 'data.frame':
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().

Details

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

Value

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

Author(s)

Paul Murrell

See Also

compare and compareEqual

Examples

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)

[Package compare version 0.2-1 Index]