Is there any difference between testing isTRUE(all.equal(x, y)) and identical(x, y)?
The help page says:
Don't use 'all.equal' directly in 'if' expressions — either use 'isTRUE(all.equal(....))' or 'identical' if appropriate.
but that "if appropriate" leaves me in doubt. How do I decide which of the two is appropriate?
all.equaltests for near equality, whileidenticalis more exact (e.g. it has no tolerance for differences, and it compares storage type). From ?identical:And one reason you would wrap
all.equalinisTRUEis becauseall.equalwill report differences rather than simply returnFALSE.