Credits Overview Plotting Styles Commands Terminals

valid

The valid(x) function may be used only in expressions that are part of a using specification. It can be used to detect explicit NaN values or unexpected garbage in a field of the input stream, perhaps to substitute a default value or to prevent further arithmetic operations using NaN. Both "missing" and NaN (not-a-number) data values are considered to be invalid, but it is important to note that if the program recognizes that a field is truly missing or contains a "missing" flag then the input line is discarded before the expression invoking valid() would be called. See plot datafile using, missing.

Example:

     # Treat an unrecognized bin value as contributing some constant
     # prior expectation to the bin total rather than ignoring it.
     plot DATA using 1 : (valid(2) ? $2 : prior) smooth unique