checkers is a framework for reviewing analysis projects. This package provides both automatied checks for best practises as well as a descriptive guide for best practices.
Our full, in-development analysis review guide is available here as a google doc. We categorize checks according to tiers of ‘best practise’ and potential degree of automation:
Example check ‘best practices’ in terms of their importance (y-axis) and the degree they can be automated (x-axis).
The checkers package runs automated tests, using extensions on the goodpractice package.
devtools::install_github('ropenscilabs/checkers')
Run gp_check()
on your analysis directory for a report on common best
practices for analysis directories.
library(checkers)
gp_check(path=system.file("scripts", package="checkers"),
checks=c("comments", "version_control"))
#> Preparing: scripts
#> Preparing: version_control
#> ── GP scripts ─────────────────────────────────────────────────────────────
#>
#> It is good practice to
#>
#> ✖ Place your project under version control. You are using
#> neither git nor svn. See http://happygitwithr.com/ for more
#> info
#> ───────────────────────────────────────────────────────────────────────────
Helper functions allow one to create custom checks for common tasks. For
instance, make_pref_pkg_check()
defines a test for preferred packages.
These helpers are used with goodpractice’s (in-development) API for
extensions:
xml_check <- make_pref_pkg_check(unfavored = "XML", favored = "xml2")
gp_check(path=system.file("scripts", package="checkers"),
checks="xml",
extra_preps = list(packages=prep_packages),
extra_checks = list(xml=xml_check))
#> Warning: partial match of 'checker' to 'checkers'
#> Preparing: packages
#> ── GP scripts ─────────────────────────────────────────────────────────────
#>
#> It is good practice to
#>
#> ✖ Use preferred packages. xml2 is preferred to XML.
#> ───────────────────────────────────────────────────────────────────────────
checkers has a growing list of default checks but may also be configured for personal or group preferences. A YAML file may be provided to set project-, user- or system-wide defaults for checks:
goodpractice:
["lintr_assignment_linter",
"lintr_line_length_linter",
"lintr_trailing_semicolon_linter" ,
"lintr_attach_detach_linter",
"lintr_setwd_linter",
"lintr_sapply_linter",
"lintr_library_require_linter",
"lintr_seq_linter"]
make_pref_pkg_check:
XML:
favored: xml2
unfavored: ["XML"]
JSON:
favored: jsonlite
unfavored: rjson
if_this_than_that:
gam:
if_this: gam
needs_that: gam.check
comment_threshold: 0.05
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.