Skip to contents

Given a matrix, it returns a dataframe with two column: - first column are max values for each column of the original matrix - second column are indices of max values

Usage

colMax(mat)

Arguments

mat

Matrix object

Value

A dataframe with values and indices of max for each column

Examples

mat <- matrix(1:9, nrow = 3)
mat
#>      [,1] [,2] [,3]
#> [1,]    1    4    7
#> [2,]    2    5    8
#> [3,]    3    6    9

colMax(mat)
#>   value index
#> 1     3     3
#> 2     6     3
#> 3     9     3