Learn R Programming

erratum (version 2.2.0)

Issue: Core Class

Description

Core class to create and handle issues.

Arguments

Active bindings

rule

Rules to perform checks, must be functions that accept a single argument and return a boolean.

message

The message (warning or error).

call

Expression or function (as string) that led to the issue.

raiser

Function to run when the raise method is called. By default the error uses stop() and warning uses warning(). The function must accept a single argument: the error message (character vector).

Methods

Public methods

Method new()

Usage

Issue$new(obj, type = c("error", "warning"))

Arguments

obj

A character string or an object of class error, or warning.

type

Type of message.

Details

Initialise

Method print()

Usage

Issue$print()

Details

Print

Print message of error or warning.

Method return()

Usage

Issue$return(n = 1)

Arguments

n

the number of generations to go back, passed to parent.frame().

Details

Return Returns self from parent function.

Method addRule()

Usage

Issue$addRule(fn)

Arguments

fn

Function defining rule, must accept a single argument and return a boolean.

Details

Add a rule

Method check()

Usage

Issue$check(obj)

Arguments

obj

Object to check by rules

Details

Add a predicate

Method raise()

Usage

Issue$raise(fn = NULL)

Arguments

fn

A function to use to raise the issue.

Details

Raise error or warning

Method clone()

The objects of this class are cloneable with this method.

Usage

Issue$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.