Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up
Currently
all.equal.data.tablegives a hard error when the second argument is not a data.table:(the error is also thrown if the first argument is not a data.table, but that would only happen if you bypassed method dispatch, in which case it's your own fault)
This makes it impossible to use common paradigms such as
if (isTRUE(all.equal(x, y)) {...}: I would have to throw atryin there just to handle the case thatx(or one of its list elements or attributes) is a data.table andy(or its corresponding element/attribute) isn't. More generally, it seems bad thatall.equal(x, y)could have such substantially different behaviour thanall.equal(y, x).This error is thrown near the very top of
all.equal.data.table:I see two possible and very simple remedies:
stopwithreturn(possibly tailoring the message to tell you which one isn't a data.table)stopclause withNextMethod()or explicitall.equal.default(such thatall.equal(dt, df)would give approximately the same message asall.equal(df, dt).Tests 1613.59 and 1613.60 explicitly check for this error, so maybe this is intentional, but consider this my request to change that. If I get a approval on either remedy, I could do the PR myself (it would be my first for an open source project, but seems simple enough!)