Skip to contents

Welcome! Happy to have you here. Thank you in advance for your contribution and interest in epocakir.

The Basics

Contributions are welcome in the form of pull requests.

Prerequisites

epocakir is written in pure R. You’ll need the R>=4.0 and dev packages. Currently R Tools is not required.

install.packages(c("devtools", "roxygen2", "lintr", "styler", "testthat", "knitr"))

Project Structure

epocakir is a standard, single R package with R code in the R/ directory, data in the data/ directory and testing using testthat.

epocakir/
├── .github/                # GitHub Actions
├── R/                      # R source code
│   ├── aki.R
│   ├── ...
│
├── data/                   # .rda Data files
│   ├── aki_pt_data.rda
│   ├── ...
│
├── data-raw/               # Data origin
│   ├── aki-data.R
│   ├── ...
│
├── man/                    # Docs auto-generated with roxygen
│   ├── aki_bCr.Rd
│   ├── ...
│
├── tests/                  # Testing
│   ├── testthat.R
│   └── testthat
│       ├── test-aki.R
│       ├── ...
│
├── cran-comments.md        # CRAN submission comments
├── DESCRIPTION             # Package metadata
├── NAMESPACE               # Auto-generated with roxygen
├── README.Rmd              # Package README
├── README.md               # Auto-generated with knitr
├── ...

Development

Running Tests

If you’re using RStudio, press Cmd/Ctrl + Shift + T (or run devtools::test() if not) to run all the tests in a package.

devtools::test()
#> ℹ Testing epocakir
#> ✔ | F W  S  OK | Context
#> ✔ |         24 | aki
#> ✔ |          6 | anemia
#> ✔ |        529 | ckd [1.0s]
#> ✔ |         44 | utils
#>
#> ══ Results ════════════════════════════
#> Duration: 2.1 s
#>
#> [ FAIL 0 | WARN 0 | SKIP 0 | PASS 603 ]

Documentation

Adding Documentation

Documentation is generated from the source code using roxygen2. To add documentation to a function, add a comment block above the function.

Building Documentation

To build the documentation, run the following command in the R console:

devtools::document()

To build the pkgdown website run the following command in the R console:

pkgdown::build_site()

Release

Preparing for Release

Set up a GitHub personal access token for the repository and create a GitHub issue with a checklist. Run through the checks as required, and additional ones below:

# Creat new GitHub issue
usethis::use_release_issue()
# Run additional checks
devtools::spell_check()
urlchecker::url_check()
rhub::check_for_cran()
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
revdepcheck::revdep_check(num_workers = 4)
devtools::check_rhub()
devtools::check_mac_release()
devtools::check_win_devel()

Submit to CRAN

Please make sure that releases are on the master branch. Instead of using usethis::use_version('minor'), commitizen is used instead.

git checkout master && git pull --rebase
git merge --no-ff rc-1.0.0
cz bump --increment MAJOR
codemetar::write_codemeta()
git add codemeta.json
git commit --amend --no-edit

devtools::submit_cran()