minIgnoreNull

Syntax

minIgnoreNull(X, Y)

Arguments

X and Y can be a numeric, LITERAL or TEMPORAL scalar, pair, vector or matrix.

Details

A binary scalar function that returns the minimum by comparing X with Y.

Difference between min and minIgnoreNull:

  • min: NULL is treated as the minimum value if nullAsMinValueForComparison=true, otherwise comparison involving NULL returns NULL.

  • minIgnoreNull: NULL is ignored in comparison and non-NULL minimum is returned. If both elements in X and Y are NULL, NULL is returned. This function is not affected by configuration parameter nullAsMinValueForComparison.

Examples

minIgnoreNull(2,matrix(1  NULL -4,-1 -4  0)) 
#0 #1
1 -1
2 -4
-4 0
minIgnoreNull(matrix(10 3 NULL, 1 7 4),matrix(1  NULL -4,-1 -4  0))
#0 #1
1 -1
3 -4
-4 0

Use minIgnoreNull with reduce to calculate the minimum for matrices of the same shape stored in a tuple:

n1 = matrix(1 1 1, 5 5 5)
n2 = matrix(10 11 12, 0 NULL -5)
n3 = matrix(-1 1 NULL, -3 0 10)
reduce(minIgnoreNull, [n1,n2,n3])
#0 #1
-1 -3
1 0
1 -5

Related function: maxIgnoreNull