It is very common operation to compare data which could have been sub-aggregated to different levels of granularity. When we align their level of granularity, then data happens to be equal. We could provide easy way to do that without user having to manually sub-aggregate each data each time.
Expected behavior:
d1 = data.table(a = 1:2, b=c(1,2))
d2 = data.table(a = c(1:2,2L), b=c(1,1,1))
d1
# a b
# <int> <num>
#1: 1 1
#2: 2 2
d2
# a b
# <int> <num>
#1: 1 1
#2: 2 1
#3: 2 1
all.equal(d1, d2, by = "a") # default: fun.aggregate=sum
# [1] TRUE
It is very common operation to compare data which could have been sub-aggregated to different levels of granularity. When we align their level of granularity, then data happens to be equal. We could provide easy way to do that without user having to manually sub-aggregate each data each time.
Expected behavior: