[R-pkg-devel] Problem enhancing a package with a predict method not declared to be an S3 method
Chris.Brien at unisa.edu.au
Sat Dec 16 05:52:30 CET 2017
Dear list members,
I am in a bind.
I have a package asremlPlus that "Enhances" the commercial package asreml (and asreml4), for which I am not a maintainer. It is not available in a public repository and because of this, when checking it for CRAN, it always gives the following NOTE, which is acceptable to CRAN:
Suggests or Enhances not in mainstream repositories:
Now asreml has three functions summary.asreml, fitted.asreml and predict.asreml that are (i) not exported and (ii) not declared to be S3 methods. In spite of this it is possible to call them using summary, fitted and predict.
However, if I do this in the code then the suite of unit tests that I have for asremlPlus fails when run with testthat::test_check with the following Error:
�[31m1. Error: predictPlus.asreml (@testPredictionsPresentation.r#17) �[39m---------------
could not find function "ie"
1: predictPlus.asreml(classify = "Sources:Type", asreml.obj = current.asr, tables = "none",
wald.tab = current.asrt$wald.tab, present = c("Type", "Species", "Sources")) at testthat/testPredictionsPresentation.r:17
2: predict(asreml.obj, classify = classify, sed = pairwise, trace = trace, ...)
3: predict.asreml(asreml.obj, classify = classify, sed = pairwise, trace = trace, ...)
On the other hand, the test completes successfully if I manually execute it line-by-line, but this is not feasible in practice because there are 21 sets of tests.
The manifest problem is "ie", which is another unexported function in asreml, apparently called by predict.asreml.
Has anyone on this list advice to offer on how this problem might be overcome?
Any help gratefully received,
Chris Brien, University of South Australia
PS I know that the problem can be avoided by calling the functions within asremlPlus using asreml:::, but this appears to be unacceptable to CRAN because it produces the NOTE
Unavailable namespaces imported from by ':::' calls:
See the note in ?`:::` about the use of this operator.
And the NOTE in ?':::' says
It is typically a design mistake to use ::: in your code since the corresponding object has probably been kept internal for a good reason. Consider contacting the package maintainer if you feel the need to access the object for anything but mere inspection.
More information about the R-package-devel