Skip to content

Imported distributions are usable in devtools::test() but fail in devtools::check() #38

@jthaman

Description

@jthaman

I have a line in a package I am working on that does some parameter estimation for the inverse gaussian distribution (from the statmod package). The code

     statistic = function(x) {
        as.list(suppressWarnings(
          fitdist(x, "invgauss",
                  start = list(mean = 1, shape = 1)
                  ))$estimate)
    }

And I have @importFrom statmod dinvgauss pinvgauss qinvgauss rinvgauss in my main file.

Now, tests I've defined that use this code work when i run them in the dev session with devtools::test(), but the tests fail using devtools::check(). I get errors such as

Error in `fitdist(x, "invgauss", start = list(mean = 1, shape = 1))`: The  dinvgauss  function must be defined
Backtrace:
    ▆
 1. ├─energyfit::ef(x, d, nsim = 50) at test.R:733:3
 2. └─energyfit:::energyfit.GOFDist(x, d, nsim = 50)
 3.   ├─energyfit:::xform_dist(x, dist)
 4.   └─energyfit:::xform_dist.InverseGaussianDist(x, dist)
 5.     └─dist$statistic(x)
 6.       ├─base::as.list(...)
 7.       ├─base::suppressWarnings(...)
 8.       │ └─base::withCallingHandlers(...)
 9.       └─fitdistrplus::fitdist(x, "invgauss", start = list(mean = 1, shape = 1))

[ FAIL 7 | WARN 0 | SKIP 0 | PASS 392 ]

I've tried a few different things, including changing "invgauss" to statmod::dinvgauss, but that does not work either. I think there is something going on with how fitdist looks for functions that is not interacting correctly the R CMD check. Appreciate if you have any ideas.

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