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

Wang, Zhu w@ngz1 @ending from uth@c@@@edu
Mon Jan 14 20:30:15 CET 2019


First, I removed the Rnw file in vignettes to make simple. 

Then I followed Duncan's suggestions below, but I had the same error.

Next, in the DESCRIPTION, I added survival in Imports, and  importFrom("survival", "survfitKM") in NAMESPACE. But I still had the same error: there is no package called 'Matrix'. 

Thanks,

Zhu

-----Original Message-----
From: Dirk Eddelbuettel [mailto:dirk.eddelbuettel using gmail.com] On Behalf Of Dirk Eddelbuettel
Sent: Monday, January 14, 2019 12:45 PM
To: Duncan Murdoch
Cc: Dirk Eddelbuettel; Wang, Zhu; r-package-devel using r-project.org
Subject: Re: [R-pkg-devel] R CMD check --as-cran problem


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