Skip to content

Tooling

Here is an overview of all the tools used in this template - including some helpful information on how to apply them - making your R code both nicer and more robust 😉.

Managing R Installations

It's recommended to use rig - the R Installation Manager - for managing R installations.

Tools

This template uses the following tools:

  • rig: R installation manager.
  • renv: R project and dependency management.
  • Air: R formatter and language server.
  • Jarl: R linter.
  • testthat: R testing suit.
  • GitHub Actions: Used for running the above automatically.

Helpful Commands

  • rig:
    • Install a specific R version, e.g. 4.6.1:
      bash
      rig add 4.6.1
    • Set a default R version, e.g. 4.6.1:
      bash
      rig default 4.6.1
  • renv:
    • Restore an R environment:
      bash
      Rscript -e "renv::restore()"
      or
      r
      renv::restore()
    • Snapshot an R environment:
      bash
      Rscript -e "renv::snapshot()"
      or
      r
      renv::snapshot()
    • Install a package:
      bash
      Rscript -e "renv::install('pkg')"
      or
      r
      renv::install("pkg")
    • Install a package from Bioconductor:
      bash
      Rscript -e "renv::install('bioc::pkg')"
      or
      r
      renv::install("bioc::pkg")
  • Air:
    • Format files:
      bash
      air format
    • Alternatively, setup air editor integration as described here.
    • Check if files are properly formatted:
      bash
      air format --check
  • Jarl:
    • Lint with jarl:
      bash
      jarl check .
  • testthat:
    • Test with testthat:
      bash
      Rscript -e "source('tests/testthat.R')"
  • Run application:
    • CLI mode (example for this application):
      bash
      Rscript run.R -f data/characters.csv
    • Shiny mode (example for this application):
      bash
      Rscript run.R -s

Released under the MIT License.