Skip to content

all.equal only reports differences in first column with differences #7903

Description

@BartJanvanRossum

When comparing two data.tables with differences in multiple columns only the difference in the first column is printed.
See the code below:

dt1 <- data.table(A = 1:5, B = 1:5)
dt2 <- data.table(A = 2:6, B = 2:6)

all.equal(dt1, dt2)

df1 <- data.frame(A = 1:5, B = 1:5)
df2 <- data.frame(A = 2:6, B = 2:6)

all.equal(df1, df2)

I expected similar output printed as when using all.equal on two data.frames, i.e. both columns that have differences reported. The latter is also what is described as output value for the function.

Activity

  1. trobx commented on Sep 27, 2026

    @trobx

    This is documented in the Details section of ?all.equal.data.table:

    For efficiency data.table method will exit on detected non-equality issues, unlike most all.equal methods which process equality checks further.

  2. ecoRoland2 commented on Sep 28, 2026

    @ecoRoland2

    all.equal.data.table could state so in its output (either in the return value or as a message).

  3. MichaelChirico commented on Sep 28, 2026

    @MichaelChirico
    Member

    We should offer an option for computing the full differences if requested

  4. jangorecki commented on Sep 28, 2026

    @jangorecki
    Member

    all.equal.data.table could state so in its output (either in the return value or as a message).

    I would say it is safe to assume that user will read manual of a function that he/she is using, especially if it "misbehaves" for them.

    Also there are couple open issues regarding all.equal, one pointing to rewrite it. #7816 (comment) that could possibly address this issue.

  5. BartJanvanRossum commented on Sep 28, 2026

    @BartJanvanRossum
    Author

    I agree with @jangorecki that I should have read the documentation more carefully. However, I did read the documentation and somehow I didn't connect For efficiency data.table method will exit on detected non-equality issues, with the single output printed.

  6. jangorecki commented on Sep 28, 2026

    @jangorecki
    Member

    Then we could improve documentation at the very least. Thanks for pointing that out.

  7. ecoRoland2 commented on Sep 29, 2026

    @ecoRoland2

    I would say it is safe to assume that user will read manual of a function that he/she is using, especially if it "misbehaves" for them.

    I'm not sure that's safe. Regardless, it's still not good UX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions