The dim() function outputs the number of rows followed by the number of columns of a given matrix.
dim()
> A = matrix(1:6, 2, 3) > A [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 > dim(A) [1] 2 3