Make sure you understand how the code base is organized before you contribute any code. Check out our R Journal paper for more details on the architecture. Basically, if you want to extend the functionalities to more classes, you need to implement the following S3 generic functions for the classes you want to support:
autoplot()
, which enables plotting a custom object withggplot2
, andfortify()
, which enables converting a custom object to a tidydata.frame
For example, if you want to implement visualizations for some_r_class
objects, you need to implement the following:
fortify.some_r_class()
to extract neccessary information into adata.frame
objectautoplot.some_r_class()
that takes whatfortify.some_r_class()
returns and create suitable visualization usingggplot2
syntax
Before sending your pull request for review, make sure your changes are consistent with the guidelines and follow the coding style described in this document.
- Include unit tests when you contribute new features, as they help to a) prove that your code works correctly, and b) guard against future breaking changes to lower the maintenance cost.
- Bug fixes also generally require unit tests, because the presence of bugs usually indicates insufficient test coverage.
- Run
devtools::test("pathToPackage")
to execute all the unit tests locally. - Unit tests are triggered automatically on Travis CI so you should be able to locate your test result here.
We are following Google's R style guide that can be found here.
- Update version and date in
DESCRIPTION
. - Add release notes in
cran-comments.md
andNEWS.md
. - Run
devtools::check(args = c("--no-build-vignettes"))
for regular CRAN checks without building vignettes. - Uninstall suggested packages and then run
devtools::check(args = c("--no-build-vignettes"), env_vars = c(
R_CHECK_DEPENDS_ONLY= "true"))
to test the package with the assumption that some suggested packages may be missing from CRAN.
remove.packages(c('cluster', 'changepoint', 'fGarch', 'forecast', 'ggrepel', 'glmnet', 'KFAS', 'lintr', 'mapdata', 'MASS', 'MSwM', 'nlme', 'raster', 'ROCR', 'sp', 'strucchange', 'survival', 'timeSeries', 'vars', 'xts', 'zoo', 'lfda'))
These packages can be installed back via devtools::install_dev_deps()
- Run
devtools::release()
to release.