R/equal.R
Function to compare the size, structure, arrangement, and UNFs of two objects.
x %unf% y unf_equal(x, y, ...)
x | A vector, matrix, dataframe, list, or object of class “UNF”, or a one-element character vector containing a UNF signature. |
---|---|
y | A vector, matrix, dataframe, list, or object of class “UNF”, or a one-element character vector containing a UNF signature. |
… | Additional arguments passed to |
An object of class UNFtest
containing the results of unf
for both objects and both identical
and all.equal
for the comparison of the two.
Compares two objects using all.equal
and additional details based on the UNF of the two objects (and, for lists, dataframes, and matrices) the constituent vectors thereof. The print method for class UNFtest
prints the UNFs for both objects and summarizes any differences between the objects. This is helpful for identifying mismatching variables.
a <- data.frame(x1=1:10, x2=11:20) b <- data.frame(x1=1:10, x2=11:20+.0005) a %unf% a#> Objects are identical #> #> UNF6:aKW4lAFNBH8vfrnrDbQZjg== #> #> UNF6:aKW4lAFNBH8vfrnrDbQZjg==a %unf% b#> Objects are not identical #> #> UNF6:aKW4lAFNBH8vfrnrDbQZjg== #> Mismatched variables: #> x2: 9J3TpGLnK8dVToQffsahtQ== #> Rows seemingly not in y: #> [1] 1 2 3 4 5 6 7 8 9 10 #> #> UNF6:dH5mdwpQ1WibJzjevZWGEQ== #> Mismatched variables: #> x2: qAqLCyWQ2YsjjA2HKZixfA== #> Rows seemingly not in x: #> [1] 1 2 3 4 5 6 7 8 9 10unf_equal(a, b, digits = 3)#> Objects are a UNF (v6:3,128) match #> #> UNF6:N3:aKW4lAFNBH8vfrnrDbQZjg== #> Rows seemingly not in y: #> [1] 1 2 3 4 5 6 7 8 9 10 #> #> UNF6:N3:aKW4lAFNBH8vfrnrDbQZjg== #> Rows seemingly not in x: #> [1] 1 2 3 4 5 6 7 8 9 10#> Objects are identical #> #> UNF6:aKW4lAFNBH8vfrnrDbQZjg== #> #> UNF6:aKW4lAFNBH8vfrnrDbQZjg==