| Line 1... |
Line 1... |
| 1 |
% File src/library/base/man/array.Rd
|
1 |
% File src/library/base/man/array.Rd
|
| 2 |
% Part of the R package, http://www.R-project.org
|
2 |
% Part of the R package, http://www.R-project.org
|
| 3 |
% Copyright 1995-2010 R Core Team
|
3 |
% Copyright 1995-2012 R Core Team
|
| 4 |
% Distributed under GPL 2 or later
|
4 |
% Distributed under GPL 2 or later
|
| 5 |
|
5 |
|
| 6 |
\name{array}
|
6 |
\name{array}
|
| 7 |
\alias{array}
|
7 |
\alias{array}
|
| 8 |
\alias{as.array}
|
8 |
\alias{as.array}
|
| Line 22... |
Line 22... |
| 22 |
vector) giving data to fill the array. Other objects are coerced by
|
22 |
vector) giving data to fill the array. Other objects are coerced by
|
| 23 |
\code{\link{as.vector}}.}
|
23 |
\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 a
|
| 25 |
vector of length one or more giving the maximal indices in
|
25 |
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
|
27 |
\item{dimnames}{either \code{NULL} or the names for the dimensions.
|
| 28 |
dimensions. This is a list with one component for each dimension,
|
28 |
This must a list (or it will be ignored) with one component for each
|
| 29 |
either \code{NULL} or a character vector of the length given by
|
29 |
dimension, either \code{NULL} or a character vector of the length
|
| 30 |
\code{dim} for that dimension. The list can be named, and the list names
|
30 |
given by \code{dim} for that dimension. The list can be named, and
|
| 31 |
will be used as names for the dimensions. If the list is shorter
|
31 |
the list names will be used as names for the dimensions. If the
|
| 32 |
than the number of dimensions, it is extended by \code{NULL}s to the
|
32 |
list is shorter than the number of dimensions, it is extended by
|
| 33 |
length required}
|
33 |
\code{NULL}s to the length required.}
|
| 34 |
\item{x}{an \R object.}
|
34 |
\item{x}{an \R object.}
|
| 35 |
\item{\dots}{additional arguments to be passed to or from methods.}
|
35 |
\item{\dots}{additional arguments to be passed to or from methods.}
|
| 36 |
}
|
36 |
}
|
| 37 |
\details{
|
37 |
\details{
|
| 38 |
An array in \R can have one, two or more dimensions. It is simply a
|
38 |
An array in \R can have one, two or more dimensions. It is simply a
|
| 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 |
In the exceptional case that \code{dims} has length 0, the result will
|
| - |
|
70 |
be a vector.
|
| - |
|
71 |
|
| 69 |
\code{as.array} is a generic function for coercing to arrays. The
|
72 |
\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
|
73 |
default method does so by attaching a \code{\link{dim}} attribute to
|
| 71 |
it. It also attaches \code{\link{dimnames}} if \code{x} has
|
74 |
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
|
75 |
\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.
|
76 |
to access the \code{dim[names]} attribute at a later time.
|