rowOrderStats: Gets an order statistic for each row (column) in a matrix

View source: R/rowOrderStats.R

rowOrderStatsR Documentation

Gets an order statistic for each row (column) in a matrix

Description

Gets an order statistic for each row (column) in a matrix.

Usage

rowOrderStats(x, rows = NULL, cols = NULL, which, dim. = dim(x), ...,
  useNames = TRUE)

colOrderStats(x, rows = NULL, cols = NULL, which, dim. = dim(x), ...,
  useNames = TRUE)

Arguments

x

An NxK matrix or, if dim. is specified, an N * K vector.

rows

A vector indicating subset of rows to operate over. If NULL, no subsetting is done.

cols

A vector indicating subset of columns to operate over. If NULL, no subsetting is done.

which

An integer index in [1,K] ([1,N]) indicating which order statistic to be returned.

dim.

An integer vector of length two specifying the dimension of x, also when not a matrix. Comment: The reason for this argument being named with a period at the end is purely technical (we get a run-time error if we try to name it dim).

...

Not used.

useNames

If TRUE (default), names attributes of the result are set, otherwise not.

Details

The implementation of rowOrderStats() is optimized for both speed and memory. To avoid coercing to doubles (and hence memory allocation), there is a unique implementation for integer matrices.

Value

Returns a numeric vector of length N (K).

Missing values

This method does not handle missing values, that is, the result corresponds to having na.rm = FALSE (if such an argument would be available).

Author(s)

The native implementation of rowOrderStats() was adopted by Henrik Bengtsson from Robert Gentleman's rowQ() in the Biobase package.

See Also

See rowMeans() in colSums().


HenrikBengtsson/matrixStats documentation built on Nov. 15, 2024, 3:20 p.m.