Description Usage Arguments Details Value Examples
View source: R/f0.rbsb1.code.r
checks the type, the length and the content of some standard object. If not correct, a message and a fatal error are issued. NA are detected and considered as wrong.
1 2 | check4tyle(x, typ, len=-1, con=rbsb.num0, message=NULL, fatal=TRUE,
na.rm=FALSE)
|
x |
object to be checked. |
typ |
The list of correct types, among 'null', 'integer', 'numeric', 'character', 'logical', 'list', 'any', 'function', 'data.frame', 'matrix'. Also are 'nlogical', 'ninteger', 'nnumeric' and 'ncharacter' for named structures. As understood, 'any' implies that no check of the type is performed. |
len |
If |
con |
If |
message |
Some additional message to be issued before stopping in case of error. |
fatal |
what to do when discovering an inconsistency ? TRUE: this function prints the message and stops; FALSE: this function returns the message as a character. |
na.rm |
Must the |
'integer' has not got the meaning in is.integer
R standard
function. 'null' must be understood as resulting TRUE with function
isempty
.
'Named character' is different from 'character':
rbsb.chara
can be used for this purpose.
a character with the message(s), when everything is OK returns a
character(0)
. But when fatal
if not OK prints the
message and stops.
1 2 3 4 5 | rbsb3k("RESET"); # for R checking compliance (useless)
check4tyle(letters, c("numeric", "character"), c(20, 30), message="!OK");
check4tyle(structure("A", .Names="a"), "ncharacter", -1, LETTERS);
check4tyle("A", "ncharacter", -1, message="BAD", fatal=FALSE);
check4tyle(structure("A", .Names="a"), "character", -1, letters, "bad", fatal=FALSE);
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.