compareIgnoreOrder: Compare Two Objects with Different Order

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/same.R

Description

Compare two objects for equality, sorting them if necessary beforehand.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
compareIgnoreOrder(model, comparison, transform = character(),
                   equal = TRUE, ...)

## S3 method for class 'data.frame'
compareIgnoreOrder(model, comparison,
                   transform=character(),
                   equal=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.

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 compareEqual().

Details

This function is generic, with specific methods for arrays, matrices, tables, and data frames.

For arrays, matrices, and tables, the dimensions are sorted (by dimnames). For data frames, the rows are sorted, not the columns.

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

1
compareIgnoreOrder(1:10, 10:1)

Example output

Attaching package:compareThe following object is masked frompackage:base:

    isTRUE

TRUE
  sorted

compare documentation built on May 2, 2019, 10:24 a.m.