checkLength {devFunc} | R Documentation |
Checking if the length of the different elements of a list corresponds to what one expects.
Description
Checking if the length of the different elements of a list corresponds to what one expects.
Usage
checkLength(listObjects, lengthObjects)
Arguments
listObjects |
List of vectors, of irrespective data type. |
lengthObjects |
Numeric vector, either of the same length as the 'listObjects' argument, or of length 1, but in the latter case, it will be tested whether or not the length of every element of the 'listObjects' argument equal this one value. |
Value
No value is returned if all vectors correspond to the length against which it is tested. An error message is thrown when the length does not corresponds for at least one element of the list.
Examples
arg1 <- 'something'
checkLength(list(arg1), 1)
checkLength(list('somethingElse', TRUE), 1)
checkLength(list('somethingElse', TRUE), c(1, 1))
arg2 <- 2:5
checkLength(list(arg1, arg2), c(1, 4))
checkLength(list(arg1, arg2), 1)
[Package devFunc version 0.1 Index]