all_equal() allows you to compare data frames, optionally ignoring row and column names. It is deprecated as of dplyr 1.1.0, because it makes it too easy to ignore important differences.
Please could someone outline (or point me to) the differences that all_equal overlooks? I find it incredibly useful and have not noticed the shortcomings. What alternatives are in use out there?
scramble <- function(x) x[sample(nrow(x)), sample(ncol(x))]
# `all_equal()` ignored row and column ordering by default,
# but we now feel that that makes it too easy to make mistakes
mtcars2 <- scramble(mtcars)
all_equal(mtcars, mtcars2)
# Instead, be explicit about the row and column ordering
all.equal(
mtcars,
mtcars2[rownames(mtcars), names(mtcars)]
)
Thank you. I had missed that.
And indeed, I had not noticed that the default behaviour was to ignore row_order
Are we saying that we just use all.equal from here on? I am not familiar with the history behind this
The documentation is not clear
I use it a lot, so definitely need the functionality
You can also check out the package {waldo} (from the same author), which does a similar thing but has a more detailed output than all.equal().
I would add that deprecated technically means the function will be removed at some point. It's more that there is no clear timeline as to when a function will actually be deleted, so it can take years. Basically as long as it takes little work to keep it alive, it might just tag along.