checkFunction(x, args = NULL, ordered = FALSE)assertFunction(x, args = NULL, ordered = FALSE, .var.name)
testFunction(x, args = NULL, ordered = FALSE)
x
. Defaults to a heuristic to determine
the name using deparse
and substitute
.character
]
Expected formal arguments.logical(1)
]
Flag whether the arguments provided in args
must be the first
length(args)
arguments of the function in the specified order.
Default is FALSE
.TRUE
.
If the check is not successful, assertFunction
throws an error message,
testFunction
returns FALSE
and checkFunction
returns
a string with the error message.assertArray
,
checkArray
, testArray
;
assertAtomicVector
,
checkAtomicVector
,
testAtomicVector
;
assertAtomic
, checkAtomic
,
testAtomic
; assertCharacter
,
checkCharacter
,
testCharacter
; assertComplex
,
checkComplex
, testComplex
;
assertDataFrame
,
checkDataFrame
,
testDataFrame
;
assertEnvironment
,
checkEnvironment
,
testEnvironment
;
assertFactor
, checkFactor
,
testFactor
; assertIntegerish
,
checkIntegerish
,
testIntegerish
;
assertInteger
, checkInteger
,
testInteger
; assertList
,
checkList
, testList
;
assertLogical
, checkLogical
,
testLogical
; assertMatrix
,
checkMatrix
, testMatrix
;
assertNumeric
, checkNumeric
,
testNumeric
; assertVector
,
checkVector
, testVector
testFunction(mean)
testFunction(mean, args = "x")
Run the code above in your browser using DataLab