You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically, because fastDummies Imports data.table but does not importFrom(data.table, ...) in its NAMESPACE, to be conservative data.table assumes that fastDummies is "unaware" of data.table[ semantics and dispatches to [.data.frame.
Where that code won't work under [.data.table. The data.table equivalent is:
.data[, !..char_cols]
# or
.data[, !char_cols, with = FALSE]
# or
.data[, .SD, .SDcols = !char_cols]
The solution is
Set .datatable.aware = TRUE anywhere in the package namespace
Edit [ usages to use [.data.table semantics where appropriate.
Happy to file a PR fixing this.
If [.data.frame usage is intentional, I'd recommend (1) using as.data.frame() or data.table::setDF() to make the use of [.data.frame more intentional/explicit or (2) defining .datatable.aware=FALSE in your namespace to make it clearer that this is intentional.
The text was updated successfully, but these errors were encountered:
See https://cran.r-project.org/web/packages/data.table/vignettes/datatable-importing.html, relevant section "data.table in Imports but nothing imported"
Basically, because
fastDummies
Importsdata.table
but does notimportFrom(data.table, ...)
in its NAMESPACE, to be conservative data.table assumes thatfastDummies
is "unaware" ofdata.table
[
semantics and dispatches to[.data.frame
.That's evident e.g. here:
fastDummies/R/dummy_cols.R
Line 223 in 1ff6181
Where that code won't work under
[.data.table
. Thedata.table
equivalent is:The solution is
.datatable.aware = TRUE
anywhere in the package namespace[
usages to use[.data.table
semantics where appropriate.Happy to file a PR fixing this.
If
[.data.frame
usage is intentional, I'd recommend (1) usingas.data.frame()
ordata.table::setDF()
to make the use of[.data.frame
more intentional/explicit or (2) defining.datatable.aware=FALSE
in your namespace to make it clearer that this is intentional.The text was updated successfully, but these errors were encountered: