contextSum

Syntax

contextSum(X, Y)

Arguments

X and Y are vectors of the same length.

Details

Get of positions that are not NULL in both X and Y, and calculate the sum of the elements in X on these positions.

Examples

$ contextSum(1 2 3 4 5, 2 3 4 5 6)
15

$ contextSum(1..3, true false true)
6

$ contextSum(1 2 NULL, 1 NULL 3)
1

Related functions: contextCount, contextSum2