Skip to contents

Useful functions for everyday programming.

Table of Contents

Installation

# From CRAN (stable version)
install.packages("toscutil")
# From Github (development version)
devtools::install_github("toscm/toscutil")

Usage

To use any function or data object, first install the package and then just enter any object’s fully qualified name into a running R session, e.g. toscutil::now_ms(). You can find a curated list of existing functions at toscm.github.io/toscutil/. Alternatively, you can load the package first, using command library("toscutil") and then access any symbol directly by its name, e.g. now_ms().

Contribute

Things you can update, are:

  1. Function code in folder R
  2. Function documentation in folder R
  3. Package documentation in folder vignettes
  4. Test cases in folder tests
  5. Dependencies in file DESCRIPTION
  6. Authors in file DESCRIPTION

Whenever you update any of those things, you should run the below commands to check that everything is still working as expected

devtools::test() # Execute tests from tests folder
devtools::check() # Check package formalities
devtools::document() # Build files in man folder
devtools::install() # Install as required by next command
pkgdown::build_site() # Build website in docs folder

After doing these steps, you can push your changes to Github and then use the following commands to release the package to CRAN:

rcmdcheck::rcmdcheck() # Slower, but more realistic test than devtools::check()
devtools::spell_check() # Check spelling. Add false positives to inst/WORDLIST
devtools::submit_cran() # Submits the package to CRAN
revdepcheck::revdep_check(num_workers = 8) # Reverse dependency check
# See https://r-pkgs.org/release.html#sec-release-revdep-checks for details

Above steps are based on: https://r-pkgs.org/release.html