Row and Column Summaries - min, max, and range

DESCRIPTION:

Minimum, maximum, or range, by row or column, or dimensions of arrays. These are generic functions; methods currently exist for data.frame, resamp, and series

USAGE:

colMins(x,   na.rm=F, dims=1, n=NULL) 
colMaxs(x,   na.rm=F, dims=1, n=NULL) 
colRanges(x, na.rm=F, dims=1, n=NULL) 
rowMins(x,   na.rm=F, dims=1, n=NULL) 
rowMaxs(x,   na.rm=F, dims=1, n=NULL) 
rowRanges(x, na.rm=F, dims=1, n=NULL) 

REQUIRED ARGUMENTS:

x
a matrix, array, vector, data frame, or bdFrame.

OPTIONAL ARGUMENTS:

na.rm
if FALSE, missing values ( NA) in the input result in missing values in corresponding elements of the output.
if TRUE, missing values are omitted from calculations.
dims
if x has dimension higher than 2, dims determines what dimensions are summarized. If dims=3 and x is a 5-dimensional array, the result of rowMeans is a 3 dimensional array consisting of the means across the remaining 2 dimensions, and the result of colMeans is a 2 dimensional array consisting of the means across the last 3 dimensions.
n
number of rows; treat x as a matrix with n rows.

VALUE:

Minimum, maximum, or ranges, by row or column.

DETAILS:

For a matrix, colMins(x) is equivalent to apply(x, 2, min) except possibly for trivial differences in how dimnames are stored. Similarly, rowMins(x) matches apply(x, 1, min). Corresponding relationships hold for the other functions. If there are any missing values, then apply is used for the calculations, and computations are slower.

The dims and n arguments should not be used for a data frame or a bdFrame.

If n is supplied then the result has no names or dimnames, and the dims argument is ignored. n is useful for working with vectors without converting them to matrices.

SEE ALSO:

, , .

EXAMPLES:

x <- matrix(1:12, 4) 
colMins(x) 
rowMins(x) 
colRanges(x) 
 
## Summaries for regular subsets of a vector 
x <- 1:10 
colMins(x, n=5)  # like colMins(matrix(x, 5)) 
 
## Higher-dimensional array 
x <- array(runif(24), dim=c(2,3,4)) 
rowMins(x)                  # vector of length 2. 
rowMins(x, dims=2)          # 2x3 matrix. 
apply(x, 1:2, min)          # same as previous 
colMins(x)                  # 3x4 matrix. 
colMins(x, dims=2)          # vector of length 4. 
colMins(aperm(x, c(2,1,3))) # 2x4 matrix