libbib icon indicating copy to clipboard operation
libbib copied to clipboard

Move data.table to Imports

Open MichaelChirico opened this issue 5 months ago • 2 comments

Depends is rarely the right form of dependency; see e.g. https://cran.r-project.org/web/packages/data.table/vignettes/datatable-importing.html and https://github.com/Rdatatable/data.table/issues/3076.

Let me know if I can help with the migration!

MichaelChirico avatar Jul 11 '25 17:07 MichaelChirico

Thanks for the feedback. What would be involved to migrate?

tonyfischetti avatar Jul 15 '25 17:07 tonyfischetti

Possibly as little as moving data.table in the DESCRIPTION from Depends: to Imports:.

But usually it involves:

  1. Adding more specific imports to NAMESPACE, like importFrom(data.table, ...). I find that most expressive to readers. Otherwise, a blanket import(data.table) will be the low-effort change.
  2. Vignettes, tests, and examples that use data.table functions need to be updated. The low-effort version is to add library(data.table) to affected scripts, otherwise we would find the corresponding functions and qualify them with data.table::

I would approach this by making the move in DESCRIPTION and then iterating R CMD check to find unqualified data.table usage.

One caveat is that if your package uses meta-programming like eval(parse(text = "data.table(...)")), that won't be caught by R CMD check, but would be caught if your test suite is extensive enough. YMMV.

MichaelChirico avatar Jul 15 '25 17:07 MichaelChirico