R: Row or Column Maximum Values of a Matrix

matMaxs {lsei} | R Documentation

## Row or Column Maximum Values of a Matrix

### Description

Finds either row or column maximum values of a matrix.

### Usage

    matMaxs(x, dim = 1)

### Arguments

`x` | numeric matrix.
`dim` | `=1`, for row maximum values; `=2`, for column maximum values.

### Details

Matrix `x` may contain `Inf` or `-Inf`, but not `NA` or `NaN`.

### Value

Returns a numeric vector with row or column maximum values.

The function is very much the same as using `apply(x, 1, max)` or `apply(x, 2, max)`, but faster.

### Author(s)

Yong Wang <yongwang@auckland.ac.nz>

### Examples

    x = cbind(c(1:4,Inf), 5:1)
    matMaxs(x)
    matMaxs(x, 2)

[Package lsei version 1.3-0 Index]