checkValues: Checking if the value of vectors (of length 1) is authorized.

Description Usage Arguments Value Examples

View source: R/checkFuncs.R

Description

Checking if the value of vectors (of length 1) is authorized.

Usage

1
checkValues(listObjects, listValues)

Arguments

listObjects

List of vectors, of irrespective data type and each of length 1. It contains the list of variables of which one wants to test its value against a vector of valid values. This argument is obligatory.

listValues

List of vectors, of irrespective data type and of the same length as the 'listObjects' argument. It contains the values against which one wants to test the 'listObjects' argument. This argument is obligatory.

Value

No value is returned if all vectors correspond to the length against which it is tested. An error message is thrown when at least one of the elements of the 'listObjects' contains an invalid value, as stipulated by the 'listValues' argument.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
lossType <- 'absolute'
checkValues(list(lossType), list(c('absolute', 'quadratic')))
checkValues(list(lossType), list(c('absolute', 'quadratic'), c('test', 'test2')))

#The next error message is weird, since it does not return the real name of the listObject
#that found to be wrong.
lossType <- 'absolute55'
listObjects <- list(lossType)
listValues <- list(c('absolute', 'quadratic'))
checkValues(listObjects, listValues)

#Now it is ok...
checkValues(list(lossType), list(c('absolute', 'quadratic')))

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

Related to checkValues in devFunc...