validateType: Validate Type (S3)

Description Usage Arguments Details Author(s) References See Also Examples

Description

Validates type (class) of an assignment value for a typed object value.

Usage

1
2
validateType(self, value, numint = TRUE, from_null = TRUE, to_null = TRUE,
  strict = c(2, 1, 0), ...)

Arguments

self

environment. Invisible object part.

value

ANY. New assignment value.

numint

logical. TRUE: do not distinguish between types (classes) numeric and integer; FALSE: threat them as two different types (classes). Default: TRUE as this seems to make most sense in practical applications.

from_null

logical. TRUE: any type (class) is valid to overwrite an initial NULL value. FALSE: this would be regarded as a type (class) mismatch. Default: TRUE as this seems to make most sense in practical applications.

to_null

logical. TRUE: value of NULL is always valid type (class) regardless of the type (class) that was stored at the initial assignment operation. FALSE: this would be regarded as a type (class) mismatch. Default: TRUE as this seems to make most sense in practical applications.

strict

numeric. How to handle type (class) mismatches:

  • 0: ignore without warning

  • 1: ignore with Warning

  • 2: stop with error

Default: 2.

...

Further arguments to be passed to subsequent functions/methods.

Details

The type (class) of the object value as stored at the initial assignment operation via setTyped is checked against the type (class) of value. Type (class) mismatches trigger an error or a warning depending on the value of strict.

Author(s)

Janko Thyson janko.thyson@rappster.de

References

http://github.com/Rappster/typr

See Also

setTyped

Examples

1
2
3
4
5
6
## Not run: 

## TODO: add example


## End(Not run)

rappster/typr documentation built on May 27, 2019, 2:02 a.m.