rowWsum

Syntax

rowWsum(X, Y)

Please see rowFunctions for the parameters and calculation rules.

Details

Calculate the cumulative weighted sum of X by row with Y as the weights and return a vector with the same number of rows of X.

Examples

m1=matrix(2 -1 4, 8 3 2, 9 0 1)
m2=matrix(8 11 10, 8 17 4, 14 6 4)
rowWsum(m1, m2)
// output
[206, 40, 52]

m3=matrix(8 NULL 10, 8 NULL 4, 14 NULL NULL)
rowWsum(m1, m3)
// output
[206, , 48]

Related function: wsum