| Line 17... |
Line 17... |
| 17 |
as.array(x, ...)
|
17 |
as.array(x, ...)
|
| 18 |
is.array(x)
|
18 |
is.array(x)
|
| 19 |
}
|
19 |
}
|
| 20 |
\arguments{
|
20 |
\arguments{
|
| 21 |
\item{data}{a vector (including a list or \code{\link{expression}}
|
21 |
\item{data}{a vector (including a list or \code{\link{expression}}
|
| 22 |
vector) giving data to fill the array. Other objects are coerced by
|
22 |
vector) giving data to fill the array. Non-atomic classed objects
|
| 23 |
\code{\link{as.vector}}.}
|
23 |
are coerced by \code{\link{as.vector}}.}
|
| 24 |
\item{dim}{the dim attribute for the array to be created, that is a
|
24 |
\item{dim}{the dim attribute for the array to be created, that is an
|
| 25 |
vector of length one or more giving the maximal indices in
|
25 |
integer vector of length one or more giving the maximal indices in
|
| 26 |
each dimension.}
|
26 |
each dimension.}
|
| 27 |
\item{dimnames}{either \code{NULL} or the names for the dimensions.
|
27 |
\item{dimnames}{either \code{NULL} or the names for the dimensions.
|
| 28 |
This must a list (or it will be ignored) with one component for each
|
28 |
This must a list (or it will be ignored) with one component for each
|
| 29 |
dimension, either \code{NULL} or a character vector of the length
|
29 |
dimension, either \code{NULL} or a character vector of the length
|
| 30 |
given by \code{dim} for that dimension. The list can be named, and
|
30 |
given by \code{dim} for that dimension. The list can be named, and
|
| Line 64... |
Line 64... |
| 64 |
fastest. If there are too few elements in \code{data} to fill the array,
|
64 |
fastest. If there are too few elements in \code{data} to fill the array,
|
| 65 |
then the elements in \code{data} are recycled. If \code{data} has
|
65 |
then the elements in \code{data} are recycled. If \code{data} has
|
| 66 |
length zero, \code{NA} of an appropriate type is used for atomic
|
66 |
length zero, \code{NA} of an appropriate type is used for atomic
|
| 67 |
vectors (\code{0} for raw vectors) and \code{NULL} for lists.
|
67 |
vectors (\code{0} for raw vectors) and \code{NULL} for lists.
|
| 68 |
|
68 |
|
| - |
|
69 |
Unlike \code{\link{matrix}}, \code{array} does not currently remove
|
| - |
|
70 |
any attributes left by \code{as.vector} from a classed list
|
| - |
|
71 |
\code{data}, so can returned a list array with a class attribute.
|
| - |
|
72 |
|
| 69 |
\code{as.array} is a generic function for coercing to arrays. The
|
73 |
\code{as.array} is a generic function for coercing to arrays. The
|
| 70 |
default method does so by attaching a \code{\link{dim}} attribute to
|
74 |
default method does so by attaching a \code{\link{dim}} attribute to
|
| 71 |
it. It also attaches \code{\link{dimnames}} if \code{x} has
|
75 |
it. It also attaches \code{\link{dimnames}} if \code{x} has
|
| 72 |
\code{\link{names}}. The sole purpose of this is to make it possible
|
76 |
\code{\link{names}}. The sole purpose of this is to make it possible
|
| 73 |
to access the \code{dim[names]} attribute at a later time.
|
77 |
to access the \code{dim[names]} attribute at a later time.
|