目录

goalie

Install with Bioconda Lifecycle: stable

Assertive check functions for defensive R programming.

Introduction

goalie is an attempt to incorporate elements of multiple assertive check packages into a single package with as few dependencies as possible. All assertive checks are written in the most basic R code possible, without reliance on compilation (e.g. C++/Rcpp). It is still a work in progress, and feature requests are welcome.

R exports the stopifnot() function as a simple assert engine that supports multiple boolean returns (TRUE/FALSE) in a single call, separated by commas. This is a nice, flexible system for defensive programming. However, stopifnot() does not currently support custom error messages, and can be confusing to debug.

Similar to the approach used in the assertthat package, goalie exports the assert() function, which is designed to be a drop-in replacement for stopifnot() with improved error message support. validate() is a variation on assert() that is intended to be used within S4 class validity checks, which is useful for Bioconductor packages.

Additionally, goalie exports a number of assertive check functions that are intended to harden bioinformatics-oriented functions in R. These check functions return logical with an additional "goalie" S4 class definition, which enables us to keep track of additional useful information about the cause of the error (see cause() for details). This approach draws heavily from the assertive package.

Installation

This is an R package.

install.packages(
    pkgs = "goalie",
    repos = c(
        "https://r.acidgenomics.com",
        getOption("repos")
    ),
    dependencies = NA
)

Conda method

Configure Conda to use the Bioconda channels.

# Don't install recipe into base environment.
name='r-goalie'
conda create --name="$name" "$name"
conda activate "$name"
R

See also

The goalie source code incorporates elements from these excellent assert check packages:

关于

用于R语言编程的输入验证和错误检查工具包

3.6 MB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802032778号