checkLength: Checking if the length of the different elements of a list...

Description Usage Arguments Value Examples

View source: R/checkFuncs.R

Description

Checking if the length of the different elements of a list corresponds to what one expects.

Usage

1
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

1
2
3
4
5
6
7
8
9
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)

devFunc documentation built on May 1, 2019, 11:32 p.m.

Related to checkLength in devFunc...