To find the index of the maximum element, you can use the which.max() function from the base package.
The basic syntax of which.max() is given below:
which.max(x)
Arguments:
x
numeric (logical, integer or double) vector or an R object for which the internal coercion to double works whose min or max is searched for.
In your case:
mat <- matrix(c(1:3,7:9,4:6), byrow = T, nc = 3)
which.max( mat[,2] )
[1] 2