Learn R Programming

matrixStats (version 0.8.5)

rowProds: Calculates the product for each row (column) in a matrix

Description

Calculates the product for each row (column) in a matrix.

Usage

rowProds(x, na.rm=FALSE, ...)
 colProds(x, na.rm=FALSE, ...)

Arguments

x
na.rm
If TRUE, missing values are ignored, otherwise not.
...
Arguments passed to rowSums().

Value

Details

Internally the product is calculated via the logarithmic transform, treating zeros and negative values specially. This enhance the precision and lower the risk for overflow.