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)
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. |
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