user3757897
user3757897

Reputation: 326

all.equal() with integer64 data type

I have two data frames, each with a column of integer64 type. When I compare the data frames using all.equal(), I get TRUE, even when the values are wildly different:

library(bit64)
original <- data.frame("a" = as.integer64(c(2, 3, 6)), "b" = c("second", "data", "column"))
new <- data.frame("a" = as.integer64(c(2, 30000, 6000001)), "b" = c("second", "data", "column"))
all.equal(original, new)
# TRUE

I know that all.equal() can accept non-exact matching (e.g. with rounding) and that for scrupulously exact matching identical() is the safer choice, but why does all.equal() say that these two data frames are the same? Is there a way to get a comparison of the data frames with the useful details of all.equal() but while rejecting these two tables as equivalent?

Upvotes: 0

Views: 53

Answers (1)

Dirk is no longer here
Dirk is no longer here

Reputation: 368409

I cannot reproduce that:

R> library(bit64)
R> original <- data.frame(a=as.integer64(c(2, 3, 6)), 
+                         b=c("second", "data", "column"))
R> new <- data.frame(a=as.integer64(c(2, 30000, 6000001)), 
+                    b=c("second", "data", "column"))
R> all.equal(original, new)
[1] "Component “a”: Mean relative difference: 669999"
R> 

What version of bit64 are you running?

Upvotes: 2

Related Questions