This help topic is for R version 0.60. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/nrow.html
nrow, ncol {base}R Documentation

The Number of Rows/Columns of an Array

Description

nrow and ncol return the number of rows or columns present in x. NCOL and NROW do the same, but treat a vector as 1-column matrix.

Usage

nrow(x)
ncol(x)
NCOL(x)
NROW(x)

Arguments

x

a vector, array or data frame

See Also

dim which returns all dimensions; array, matrix.

Examples

ma <- matrix(1:12, 3, 4)
nrow(ma)   # 3
ncol(ma)   # 4

ncol(array(1:24, dim = 2:4)) # 3, the second dimension
NCOL(1:12) # 1
NROW(1:12) # 12

[Package base version 0.60 ]