rowProds: Row products

Description Usage Arguments Details Value Author(s) Examples

View source: R/functions.r

Description

Form row products for numeric arrays.

Usage

1
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 (abreu_ga@yahoo.com.br)

Examples

1
2
3
4
5
6
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 
# [4] -5.451996e-07  3.057436e-04

gRapHD documentation built on Feb. 9, 2018, 6:05 a.m.

Related to rowProds in gRapHD...