Include non-CRAN package in CRAN package

2020-04-02 07:16发布

问题:

The question is pretty simple. First:

  1. Is it possible to include a non-CRAN (or bioconductor, or omega hat) package in a CRAN package and actually use tools from that package in examples.
  2. If yes how does one set up the DESCRIPTION file etc. to make it legit and pass CRAN checks?

Specifically I'm asking about openNLPmodels.en that used to be a CRAN package. It's pretty useful and want to include functionality from it. I could do a work around and not actual use openNLPmodels.en in the examples or create unit tests for it, and have it install when a function gets use (similar to how the gender package installs the data sets it needs) but I'd prefer an approach that allows me to run checks, texts, examples.

This is how one downloads and installs openNLPmodels.en

install.packages(
    "http://datacube.wu.ac.at/src/contrib/openNLPmodels.en_1.5-1.tar.gz",  
    repos=NULL, 
    type="source"
)

回答1:

Its possible, but! ...

There is a field in the DESCRIPTION file that that you can use:

Additional_repositories: http://ghrr.github.io/drat

BUT!

Everything that depends on the functionality from the package from the additional repository has to be absolutely optional.

So packages from this repo should be placed under Suggests.

Example

I am not 100% sure whether or not BioConductor and OmegaHat are considered mainstream or not.



标签: r package cran