I would like to compare two arrays. I need to test near equality among each elements .
I am using all.equal(target, current , tolerance = ...), but it's probably wrong or maybe i didn't understand how all.equal works.
I would like something with this behavior:
a <-array(1:18, dim=c(3,3,2))
b <- a
b[3,3,2] <-18.01
all.equal(a,b,tolerance = 0.1) # return TRUE
all.equal(a,b,tolerance = 0.001) # return TRUE
newFunction(a,b, tolerance = 0.1) # return TRUE
newFunction(a,b, tolerance = 0.001) # return FALSE
Should i vectorized all.equal? Can you give me an hint please