The Comprehensive R Archive Network (CRAN) is the official repository for R packages. It is a network of servers that store and distribute R packages, ensuring they meet strict quality standards. We encourage DataSHIELD package developers to submit their packages to CRAN, as it ensures a minimum quality has been achieved.
First, follow all of the previous steps in the developer guide. These are required for the package to meet the minimum CRAN requirements. Further information is available on the CRAN website:
To check the spelling of the documentation, run
devtools::spell_check()
Note that CRAN requires the terms 'DataSHIELD', 'server-side' and 'client-side' to be enclosed within apostrophes in the DESCRIPTION file.
For a package to be accepted by CRAN, all dependent packages listed in 'imports' or 'suggests' need to be hosted in a recognised repository. Whilst dsBase
and dsBaseClient
are not currently in the main CRAN repository, they are hosted at https://cran.obiba.org/. Indicate this by adding the following line to the DESCRIPTION file:
Additional_repositories: https://cran.obiba.org/
To be accepted by CRAN, your package needs to pass a series of automated checks. If you use either dsBase
or dsBaseClient
in your unit tests (e.g. a call to ds.colnames
), your package will fail the CRAN checks. To circumnavigate the issue, you can add the following line to all tests which depend on any DataSHIELD package not currently in CRAN:
skip_if_not_installed("dsBaseClient")
Prior to submitting to CRAN, you can approximate their checks by running:
devtools::check_win_devel() # Check package on the development version of R.
devtools::check_win_release() # Check package on the release version of R.
devtools::check_win_oldrelease() # Check package on the previous major release version of R.
This will check your package and email your results. You should fix any errors, warnings or notes. You package will be rejected by CRAN even if it only contains notes.
Once you have passed this pre-check, build a .tar.gz file for submission:
devtools::build()