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

Duncan Murdoch murdoch@dunc@n @ending from gm@il@com
Mon Jan 14 19:19:23 CET 2019


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.

Duncan Murdoch



More information about the R-package-devel mailing list