rowProds {gRapHD}R Documentation

Row products

Description

Form row products for numeric arrays.

Usage

  rowProds(x,na.rm=TRUE)

Arguments

x matrix.
na.rm logical. Whether missing values (including NaN) are omitted from the calculations.

Details

Equivalent to use of apply with FUN = prod and MARGIN = 1, but is faster.

Value

Vector with length nrow(x).

Author(s)

Gabriel Coelho Goncalves de Abreu (Gabriel.Abreu@agrsci.dk)
Rodrigo Labouriau (Rodrigo.Labouriau@agrsci.dk)
David Edwards (David.Edwards@agrsci.dk)

Examples

  set.seed(1,kind="Mersenne-Twister")
  a <- matrix(rnorm(100),nrow=5)
  x <- rowProds(x=a, na.rm=TRUE)
  # x
  # [1] -3.359208e-07 -2.861043e-10 -2.831108e-08 -5.451996e-07  3.057436e-04

[Package gRapHD version 0.1.0 Index]