check: Check Objects

View source: R/check.R

checkR Documentation

Check Objects

Description

check is a generic function that tests the validity of a given object.

Usage

check(object, ...)

Arguments

object

an object to be tested for validity.

...

further arguments to be passed to the particular dispatched function.

Details

check tests if a given object meets the formal requirements of being a valid object of its class. If the test fails, additional warnings should be provided, giving some information why the test failed.

Value

returns TRUE if object passes the validity test for the specific class and FALSE otherwise.

Note

R's dispatching mechanism determines the class of a given object and then calls the function check.<class-name>. If no specific check function is found, check.default is called. The function check.default does not make much sense, for the purpose of check is to test the validity for a specific class. Hence, check.default simply returns FALSE together with a warning message that no specific check.<class-name> function was found.

The dispatching mechanism has immediately two consequences:

  1. a class specific check routine need not to check whether the object belongs to the class itself, because if it would not, the function would not have been called.

  2. if no specific check routine is found, the result for a call of check will be FALSE, since in this case the default function is called which will return FALSE in any case.

Author(s)

Thorn Thaler


ttutils documentation built on April 5, 2022, 1:15 a.m.

Related to check in ttutils...