Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

matmax

Row-wise matrix functions


Description

Compute maximum or minimum of each row, or sort each row of a matrix, or a set of (equal length) vectors.

Usage

matmax(...)

Arguments

...

A numeric matrix or a set of numeric vectors (that are column-wise bind together into a matrix with cbind).

Value

matmin and matmax return a vector of length nrow(cbind(...)). matsort returns a matrix of dimension dim(cbind(...)) with in each row of cbind(...) sorted. matsort(x) is a lot faster than, e.g., t(apply(x,1,sort)), if x is tall (i.e., nrow(x)>>ncol(x) and ncol(x)<30. If ncol(x)>30 then matsort simply calls 't(apply(x,1,sort))'. matorder returns a permutation which rearranges its first argument into ascending order, breaking ties by further arguments.

Author(s)

Raoul Grasman

Examples

example(Unique)

geometry

Mesh Generation and Surface Tessellation

v0.4.5
GPL (>= 3)
Authors
Jean-Romain Roussel [cph, ctb] (wrote tsearch function with QuadTrees), C. B. Barber [cph], Kai Habel [cph, aut], Raoul Grasman [cph, aut], Robert B. Gramacy [cph, aut], Pavlo Mozharovskyi [cph, aut], David C. Sterratt [cph, aut, cre] (<https://orcid.org/0000-0001-9092-9099>)
Initial release
2019-12-02

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.