MyNixOS website logo
Description

Checks 'R' Configuration Set Up Correctly Before Class.

Checks that students have the correct version of 'R', 'R' packages, 'RStudio' and other dependencies installed, and that the recommended 'RStudio' configuration has been applied.

checker

R-CMD-check CRANstatus

One of the challenges with teaching R is that some students come to practicals with very old versions of R, or without critical packages installed. There are several solutions to this:

  • use posit cloud (formerly RStudio cloud), where the instructor can control the versions of software and packages used
  • have the class install a package that has all necessary packages for the course as dependencies
  • use the renv package to install packages listed in a lockfile
  • use a rocker container

One problem with these options is that they take control of package installation, rather than giving the student practice installing packages.

The checker attempts to be an alternative solution. It checks whether the recommended (or more recent) versions of R, RStudio and packages, as specified in a yaml file, are installed and that recommended RStudio options are set. A sample yaml file is included in the installation. One can also be supplied with a URL or path.

Installation

You can install the development version of checker from GitHub with:

# install.packages("remotes")
remotes::install_github("richardjtelford/checker")

Usage

The function chk_requirements() is the only function the user needs to run.

library(checker)
chk_requirements()
#> → Date = 2023-04-26 14:06:33.580533
#> → os = Ubuntu 18.04.6 LTS
#> ✖ Are you using RStudio?
#> ✔ R version 4.3.0 is installed
#> ✔ quarto version 1.3.262 is installed
#> ✔ git version 2.17.1 is installed
#> → Checking R packages
#> ✔ tidyverse version 2.0.0 is installed
#> ✔ here version 1.0.1 is installed
#> ✔ quarto version 1.2 is installed
#> ✖ You have some issues that need addressing

By default, chk_requirements() uses a yaml file included in the installation. To run chk_requirements() with your own set of requirements, you can use a URL or file path.

chk_requirements(path = url("https://raw.githubusercontent.com/richardjtelford/checker/main/inst/default.yaml"))

The yaml file

Below is the yaml file included in the installation. It can be edited to meet your requirements by hand or with the function chk_make() which takes data.frames of recommended programs, packages, and RStudio options as arguments. Recommended and/or minimum version and any message can be included in these data.frames.

---
R:
  recommended: 4.3.0
  minimum: 4.2.0
packages:
  tidyverse:
    recommended: 2.0.0
  here: NA
  quarto: NA
rstudio:
  recommended: 2023.03.0
  options:
    save_workspace:
      value: never
      message: >
        Improve reproducibility by never saving the workspace.
        Menu tools > Global options > General
    load_workspace:
      value: FALSE
      message: >
        Set load workspace to FALSE to improve reproducibility.
        Menu tools > Global options > General
    rainbow_parentheses:
      value: TRUE
      message: >
        Rainbow parentheses make it easier to spot missing parentheses.
        Menu tools > Global options > Code > Display
    soft_wrap_r_files:
      value: TRUE
      message: >
        Soft wrap files so you do not need to scroll sideways.
        Menu tools > Global options > Code > Editing
    insert_native_pipe_operator:
      value: TRUE
      message: >
        Use the native pipe operator '|>'.
        Menu tools > Global options > Code > Editing
quarto:
  recommended: 1.3.262
git: NA
---

The accepted keys are

  • r_version
  • rstudio
  • quarto
  • git
  • packages

All keys are optional. The first four take “recommended” and “minimum” to specify the recommended and minimum versions (if only one of “recommended” and “minimum” is set, they are treated in the same). If any version is acceptable, use NA.

The “rstudio” key also accepts an options field, which takes the name with value set to the recommended value and an optional message. A list of RStudio options can be found with usethis:::rstudio_prefs_read().

The “packages” key has an element for each package installed. These take the same recommended” and “minimum” fields as above, and also a “message” field which is printed in the package is not installed (the “>” lets the message span several lines). The message could be used to point to the location of packages not available on CRAN.

The dashes denote the start and end of the yaml are optional. The formatting with white space must be followed.

Metadata

Version

0.1.3

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows