waldo
waldo copied to clipboard
Tolerance behaves differently than (naively) expected
When using compare
on vectors (lists, data.frames, etc), the tolerance
paremater works differently than a naive user would expect. Rather than comparing each entry's deviation separately, it considers the mean deviation of all deviating entries.
While this matches the documented behavior, it probably isn't what a user would intuitively expect.
Contrived minimal example:
vec1 <- rep(1, 1000)
vec2 <- rep(1.01, 1000)
vec2[1000] <- 10
waldo::compare(vec1, vec2, tolerance = 0.1)
results in
✔ No differences
while many users would probably expect to see the last line (and only the last line) highlighted as difference.