Skip to content

Latest commit

 

History

History
316 lines (271 loc) · 10.9 KB

README.md

File metadata and controls

316 lines (271 loc) · 10.9 KB

NVIcheckmate: Extension of checkmate with argument checking adapted for NVIverse

Overview

NVIcheckmate extends checkmate with functions for argument checking that are adapted for NVIverse.

NVIcheckmate is part of NVIverse, a collection of R-packages with tools to facilitate data management and data reporting at the Norwegian Veterinary Institute (NVI). The NVIverse consists of the following packages: NVIconfig, NVIdb, NVIpjsr, NVIspatial, NVIpretty, NVIbatch, OKplan, OKcheck, NVIcheckmate, NVIpackager, NVIrpackages. See Contribute to NVIcheckmate for more information.

The main purpose of NVIcheckmate is to provide checks and assertions for functions in NVIverse in the case that the checks and assertions are not available in checkmate. These include specialized argument checking as well as checking other requirements like if a package is installed, if the users credentials are available and, if an valid ODBC-channel exists.

In addition, an argument for adding a custom message is included in selected assertions from checkmate. Thereby, the error messages for a specific function may be explained to provide more meaningful error messages.

NVIcheckmate is intended for use together with checkmate. NVIcheckmate intend to follow the same principles as checkmate concerning input and error messages. The argument checking in NVIverse uses the assert class in checkmate for collecting and reporting the assertions, and assertions from checkmate and NVIcheckmate are combined when checking the arguments of a function.

When and if functionality covered by NVIcheckmate are included in checkmate as available at Cran, the corresponding function will be depreciated and thereafter removed from NVIcheckmate.

Installation

NVIcheckmate is available at GitHub. To install NVIcheckmate you will need:

  • R version > 4.1.0
  • R package remotes
  • Rtools version 4.0, 4.2, 4.3 or 4.4 depending on R version

First install and attach the remotes package.

install.packages("remotes")
library(remotes)

To install (or update) the NVIcheckmate package without vignettes, run the following code:

remotes::install_github("NorwegianVeterinaryInstitute/NVIcheckmate",
    upgrade = FALSE,
    build = TRUE,
    build_vignettes = FALSE)

To install (or update) the NVIcheckmate package with vignettes, you will need to first install some additional R-packages needed to build the vignettes. Check README below in the section Vignettes to see which vignettes are available. To install the package with the vignettes, first install the packages: knitr, rmarkdown, R.rsp, and NVIrpackages (from GitHub) if they are missing. If you don’t use R-studio, you will also need to install Pandoc. Then run the following code:

remotes::install_github("NorwegianVeterinaryInstitute/NVIcheckmate",
    upgrade = FALSE,
    build = TRUE,
    build_vignettes = TRUE)

Usage

The NVIcheckmate package needs to be attached.

library(NVIcheckmate)

NVIcheckmateextends checkmate with functions for argument checking that are adapted for NVIverse. NVIcheckmate is intended to be used together with checkmate.

Further documentation

Help

The full list of all available functions and datasets can be accessed by typing

help(package = "NVIcheckmate")
Vignettes

Consult the vignettes for task-oriented help.

vignette(package = "NVIcheckmate")

Vignettes in package NVIcheckmate:

  • Contribute to NVIcheckmate (html)
  • NVIcheckmate reference manual (pdf)
NEWS

Please check the NEWS for information on new features, bug fixes and other changes.

Copyright and license

NVIcheckmate

Copyright (c) 2021 - 2024 Norwegian Veterinary Institute.
Licensed under the BSD_3_clause License. See License for details.

Functions and code from checkmate have been imported into NVIcheckmate. For some of them, the code have been partly modified. An overwiew of the functional modifications are given in Table 2. In addition, some technical changes like escaping character, changing links and correcting typos have been performed. The modifications are listed in the respective source files. Code from checkmate are the copyright of the copyright holders of checkmate.

checkmate

Copyright (c) 2019 - 2022 Michael Lang (michellang@@gmail.com)
License: BSD 3-Clause

Table 2. Functions and code imported from checkmate

Function Directory Description Functional modifications
assert.R ./R Combines multiple checks into one assertion Includes the argument ‘comment’
mstopOrPush ./R Internal function. Located in file assert.R None
mstop ./R Internal function. Located in file helper.R None
makeAssertFunction.R ./R Creates an assertion function from a check function Adds the argument ‘comment’ when creating an assertion function
assert_character ./R Check if an argument is a vector of type character Based on checkCharacter and includes the argument ‘comment’
assert_data_frame ./R Check if an argument is a data frame Based on check_data_frame and includes the argument ‘comment’
assert_disjunct ./R Check if an argument is a vector of type character Based on checkDisjunct and includes the argument ‘comment’
assert_integer ./R Check if an argument is a vector of type integer Based on checkInteger and includes the argument ‘comment’
assert_integerish ./R Check if an argument is a vector of type intergish Based on checkIntegerish and includes the argument ‘comment’
assert_names ./R Perform various checks on character vectors, usually names Based on checkNames and includes the argument ‘comment’
assert.R ./man-roxygen help template None
bounds.R ./man-roxygen help template None
checker.R ./man-roxygen help template Only included information on check_- and assert_-functions, the rest were removed
fmatch.R ./man-roxygen help template None
makeFunction.R ./man-roxygen help template None
na-handling.R ./man-roxygen help template None
null.ok.R ./man-roxygen help template None
sorted.R ./man-roxygen help template None
typed.missing.R ./man-roxygen help template None
x.R ./man-roxygen help template None

Contributing

Contributions to develop NVIcheckmate is highly appreciated. There are several ways you can contribute to this project: ask a question, propose an idea, report a bug, improve the documentation, or contribute code. See Contribute to NVIcheckmate for more information.

Please note that the NVIcheckmate project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.