Closed jabortell closed 3 years ago
I found that simply converting df_new
and df_old
to data.tables at the top of compare_df
like so
data.table::setDT(df_old)
data.table::setDT(df_new)
and changing the line in my comment above to
both_tables$df_new = both_tables$df_new[, .SD, .SDcols = names(both_tables$df_old)]
was sufficient. I reran all tests, and they all succeeded. Note that both_tables$df_new[, names(both_tables$df_old), with = FALSE]
is equivalent, but I think the intention is clearer through the .SD
syntax.
If you'd like that I would submit a pull request I could do that.
@jabortell - Sounds great - Please submit a PR, I'll take a look and merge. Thanks for contributing :)
Done. See PR #40
Merged and closing
If
df_new
is already a data.table thencompare_df
fails:The issue appears to be line fnsCompare.R:65
If
df_new
is a data.table, thenboth_tables$df_new
becomes the character vectornames(both_tables$df_old)
, rather than a table with the same columns and data asdf_old
.