identicalNoAttr: Equality testing with some attributes ignored

View source: R/identical.R

identicalNoAttrR Documentation

Equality testing with some attributes ignored

Description

A wrapper for function identical. Some attributes of the two objects can be ignored when testing.

Usage

identicalNoAttr(x, y, ignore.attrs = NULL, ...)

identicalFMatch(x, y, ...)

Arguments

x, y

Any R objects.

ignore.attrs

Names of attributes in 'x' and 'y'. The selected attributes will be removed before testing. Default is 'NULL' (keep all attributes)

...

Arguments passed to identical.

Details

'identicalFMatch' is a wrapper for 'identicalNoAttr', where 'ignore.attrs' is set to '".match.hash"'. This function is helpful to test two vectors after using fmatch, which add external hash tables to the compared vectors.

Value

A single logical value ('TRUE' or 'FALSE'), same as identical.

Examples

x1 <- LETTERS[1:10]
x2 <- sample(x1, 5)
x3 <- x1[fastmatch::fmatch(x2, x1)]
identical(x3, x2)  ## TRUE, but x1 has the '.match.hash' attribute now.

identical(LETTERS[1:10], x1)  ## FALSE
identicalFMatch(x3, x2)  ## TRUE


easy.utils documentation built on April 4, 2025, 6:13 a.m.