Skip to content

devtools::test when package Depends on data.table, but does not import it #192

@gsee

Description

@gsee

When a package Depends on data.table (and does not import it), sometimes using devtools::test on the package can break some functions that use data.table. I filed a bug report for data.table, but it's not clear that is a data.table issue. Here is the link to the data.table bug report: https://r-forge.r-project.org/tracker/?func=detail&atid=975&aid=2367&group_id=240

I don't see a way to attach files to this, but here is a link (that should be a direct download) to the package that I attached to the data.table bug report: https://r-forge.r-project.org/tracker/download.php/240/975/2367/275/anRpackage_1.0.tar.gz

The package has 2 functions: myFun assigns some values to a column of a data.table by reference. myFun2() creates a data.table, and then calls myFun() to change the values of one of the columns of the data.table myFun2() created.

The package also has a testthat test that simply tests that myFun2 returns a data.table.

The package passes R CMD check, and test_dir. However, if I use devtools::test, I get an error, and for the remainder of the R session, myFun() and myFun2() will fail with the same error.

Here is a link to the output from an interactive session (attached to the data.table bug report) showing the problem: https://r-forge.r-project.org/tracker/download.php/240/975/2367/276/interactive.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions