Creates or tests for arrays.
array(data = NA, dim = length(data), dimnames = NULL)
as.array(x, ...)
is.array(x)
| Parameter | Description |
|---|---|
data |
a vector (including a list or expression vector) giving data to fill the array. Non-atomic classed objects are coerced by as.vector. |
dim |
the dim attribute for the array to be created, that is an integer vector of length one or more giving the maximal indices in each dimension. |
dimnames |
either NULL or the names for the dimensions. This must a list (or it will be ignored) with one component for each dimension, either NULL or a character vector of the length given by dim for that dimension. The list can be named, and the list names will be used as names for the dimensions. If the list is shorter than the number of dimensions, it is extended by NULLs to the length required. |
x |
an R object. |
… |
additional arguments to be passed to or from methods. |
# NOT RUN {
dim(as.array(letters))
array(1:3, c(2,4)) # recycle 1:3 "2 2/3 times"
# [,1] [,2] [,3] [,4]
#[1,] 1 3 2 1
#[2,] 2 1 3 2
# }