colMins
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 = FALSE, dims = 1, n = NULL) 
colMaxs(x,   na.rm = FALSE, dims = 1, n = NULL) 
colRanges(x, na.rm = FALSE, dims = 1, n = NULL) 
rowMins(x,   na.rm = FALSE, dims = 1, n = NULL) 
rowMaxs(x,   na.rm = FALSE, dims = 1, n = NULL) 
rowRanges(x, na.rm = FALSE, dims = 1, n = NULL)

Arguments

x a matrix, array, vector, or data frame.
na.rm if FALSE, missing values (NAs) 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.

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.
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.
Value
Minimum, maximum, or ranges, by row or column.
Differences between Spotfire Enterprise Runtime for R and Open-source R
colMins, colMaxs, colRanges, rowMins, rowMaxs, and rowRanges are not in open-source R.
See Also
apply, min, colProds colMeans.
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

Package terrUtils version 6.1.1-7
Package Index