all_equal deprecated in dplyr 1.1.0 (Jan 2023)

I read here (all_equal: Flexible equality comparison for data frames in tidyverse/dplyr: A Grammar of Data Manipulation) that all_equal will be deprecated:

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?

1 Like

The text you linked had an example section

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)]
)

The text you linked had an example section

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

Deprecated doesnt mean it will disappear. It means it wont be recommended, and if people raise bugs they may not be addressed.

Deprecated doesnt mean it will disappear. It means it wont be recommended, and if people raise bugs they may not be addressed.

Thank you. Some systems (eg Python) use "deprecated" to mean that the functionality will disappear in future releases. So good to know.

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.

1 Like

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.