[R-pkg-devel] R CMD check --as-cran problem

Dirk Eddelbuettel edd @ending from debi@n@org
Mon Jan 14 19:44:36 CET 2019


On 14 January 2019 at 13:19, Duncan Murdoch wrote:
| On 14/01/2019 12:37 p.m., Dirk Eddelbuettel wrote:
| > 
| > On 14 January 2019 at 16:52, Wang, Zhu wrote:
| > | Thanks Dirk and Klaus. The package Matrix is not used directly but it is used by package survival, which was called in Suggests.  So I am not sure what is the problem. But why CRAN has no such error https://cran.r-project.org/web/checks/check_results_bujar.html. I assumed the CRAN check uses the same R version 3.5.2 as I have. The problem only occurred when I used --as-cran option.
| > 
| > Doesn't this mean that you may to ensure Matrix is present when survival
| > might be used -- so if your package suggests survival it should also suggest
| > Matrix?
| 
| That shouldn't be necessary.  Since survival imports Matrix, you 
| shouldn't be able to load survival unless Matrix is available. 
| requireNamespace("survival") should fail.
| 
| I think the problem in bujar is that it never checks 
| requireNamespace("survival"), it just calls 
| getFromNamespace('survfitKM','survival').  That will usually work (just 
| about everyone has survival installed, since it's recommended), but is 
| unsafe.  Zhu should use survival::survfitKM, but only after checking 
| that requireNamespace("survival") is successful.

Yes, I agree. I mostly tried to be helpful but my email wasn't all that
effective in that.

Zhu: the behaviour when --as-cran is not set is irrelevant as CRAN asks you
to test with --as-cran set, so there really is only one relevant choice.

And Duncan now kindly detailed the appropriate use case: test for a suggested
package. Or if your use is not conditional, import from it.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-package-devel mailing list