Retrieve or set the dimension of an object.
dim(x)
dim(x) <- value
| Parameter | Description |
|---|---|
x |
an R object, for example a matrix, array or data frame. |
value |
For the default method, either NULL or a numeric vector, which is coerced to integer (by truncation). |
# NOT RUN {
x <- 1:12 ; dim(x) <- c(3,4)
x
# simple versions of nrow and ncol could be defined as follows
nrow0 <- function(x) dim(x)[1]
ncol0 <- function(x) dim(x)[2]
# }