NVIpkg <- params$NVIpkg
NVIpkg_inline <- paste0("`", NVIpkg, "`")
logo_path <- ""
if (file.exists(paste0("./man/figures/", NVIpkg, "_logo.png"))) {
  logo_path <- paste0(' <img src="man/figures/', NVIpkg, '_logo.png" align="right" height="138" />')
}

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

r paste0(NVIpkg, ": ", desc::desc_get_field(key = "Title"), logo_path)

Overview

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

description <- desc::desc_get_field(key = "Description")

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


Usage


r paste0(NVIpkg_inline, "", sub(substr(description,1,1), tolower(substr(description,1,1)), description))


Copyright and license

NVIcheckmate


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

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

Contributing






NorwegianVeterinaryInstitute/NVIcheckmate documentation built on Dec. 14, 2024, 10:43 p.m.