nrow {base} | R Documentation |
nrow
and ncol
return the number of rows or columns
present in x
.
NCOL
and NROW
do the same treating a vector as
1-column matrix.
nrow(x) ncol(x) NCOL(x) NROW(x)
x |
a vector, array or data frame |
an integer
of length 1 or NULL
.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
The New S Language.
Wadsworth & Brooks/Cole (ncol
and nrow
.)
dim
which returns all dimensions;
array
, matrix
.
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