Learn R Programming

polyMatrix (version 0.3.1)

matrixMinMax: Maximums and minimums for numeric matrices

Description

Calculate the maximums or minimums column-wise or row-wise, depending on the called method.

Usage

colMax(matrix) # column maximums
  colMin(matrix) # column minimums
  rowMax(matrix) # row maximums
  rowMin(matrix) # row minimums

Arguments

matrix

a matrix class object

Value

A vector by the column or row maximums or minimums of the given matrix.

See Also

colMin, rowMax, rowMin

Examples

Run this code
# NOT RUN {
  set.seed(123)
  M <- matrix(rpois(12,3),3,4)
  M
  # 2 5 3 3
  # 4 6 5 6
  # 2 0 3 3

  colMax(M)  # c(4,6,5,6)
  colMin(M)  # c(2,0,3,3)
  rowMax(M)  # c(5,6,3)
  rowMin(M)  # c(2,4,0)
  # clean up
  # rm(M)
# }

Run the code above in your browser using DataLab