Open mb706 opened 6 months ago
a work-around you can use with current code is to just copy the data tables, data.table(your_dt_with_index)
which will remove the index I believe.
this functionality seems reasonable to me, so if you could draft a PR, it would be appreciated.
Different tables that contain the same data and also behave pretty much the same will not be
all.equal()
when they have different indices. Indices can sometimes appear automatically depending on what operations are performed with tables, so I think it can often be reasonable to ignore differences in indices.While one can set
check.attributes = FALSE
, this also ignores other more important things like column namesThe user can set / unset indices in tables before checking with
all.equals()
, but that gets unnecessarily complicated when the tables are buried inside larger objects.It would therefore be useful to have an option
check.indices
orignore.indices
that makesall.equal()
ignore data.table indices.My use case is that I use
all.equal.data.table
a lot in unit tests, where I verify that objects created in different ways still contain the same data. Tables may have different indices depending on how objects are created, but because these indices make no relevant difference in object behaviour I would like to ignore them.