Check of Variable Class

Description

Utility functions in optimbase meant to check variable class. Stop the algorithm if the variable is not of the expected class.

assert.classboolean

for logical variables

assert.classfunction

for functions

assert.classreal

for numeric variables

assert.classinteger

for integer variables

assert.classstring

for character variables

unknownValueForOption stops the algorithm and returns an error message, when some checks in optimbase are not successful.

Usage

1
2
3
4
5
6
  assert.classboolean(var = NULL, varname = NULL, ivar = NULL)
  assert.classfunction(var = NULL, varname = NULL, ivar = NULL)
  assert.classreal(var = NULL, varname = NULL, ivar = NULL)
  assert.classinteger(var = NULL, varname = NULL, ivar = NULL)
  assert.classstring(var = NULL, varname = NULL, ivar = NULL)
  unknownValueForOption(value = NULL, optionname = NULL)

Arguments

var

The variable name.

varname

The name of a variable to which var should have been assigned to.

ivar

A integer, meant to provide additional info on varname in the error message.

value

A numeric or a string.

optionname

The name of a variable for which value is unknown.

Value

Return an error message through the stop function.

Author(s)

Author of Scilab optimbase module: Michael Baudin (INRIA - Digiteo)

Author of R adaptation: Sebastien Bihorel (sb.pmlab@gmail.com)