The R Project SVN R

Rev

Rev 42333 | Rev 47054 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 42333 Rev 45616
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-2007 R Core Development Team
3
% Copyright 1995-2008 R Core Development 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}
-
 
9
\alias{as.array.default}
9
\alias{is.array}
10
\alias{is.array}
10
\title{Multi-way Arrays}
11
\title{Multi-way Arrays}
11
\description{
12
\description{
12
  Creates or tests for arrays.
13
  Creates or tests for arrays.
13
}
14
}
14
\usage{
15
\usage{
15
array(data = NA, dim = length(data), dimnames = NULL)
16
array(data = NA, dim = length(data), dimnames = NULL)
16
as.array(x)
17
as.array(x, ...)
17
is.array(x)
18
is.array(x)
18
}
19
}
19
\arguments{
20
\arguments{
20
  \item{data}{a vector (including a list) giving data to fill the array.}
21
  \item{data}{a vector (including a list) giving data to fill the array.}
21
  \item{dim}{the dim attribute for the array to be created, that is a
22
  \item{dim}{the dim attribute for the array to be created, that is a
Line 24... Line 25...
24
  \item{dimnames}{the names for the dimensions. This is a list with one
25
  \item{dimnames}{the names for the dimensions. This is a list with one
25
    component for each dimension, either NULL or a character vector of
26
    component for each dimension, either NULL or a character vector of
26
    the length given by \code{dim} for that dimension.  The list can be
27
    the length given by \code{dim} for that dimension.  The list can be
27
    names, and the names will be used as names for the dimensions.}
28
    names, and the names will be used as names for the dimensions.}
28
  \item{x}{an \R object.}
29
  \item{x}{an \R object.}
-
 
30
  \item{\dots}{additional arguments to be passed to or from methods.}
29
}
31
}
30
\value{
32
\value{
31
  \code{array} returns an array with the extents specified in \code{dim}
33
  \code{array} returns an array with the extents specified in \code{dim}
32
  and naming information in \code{dimnames}.  The values in \code{data} are
34
  and naming information in \code{dimnames}.  The values in \code{data} are
33
  taken to be those in the array with the leftmost subscript moving
35
  taken to be those in the array with the leftmost subscript moving
34
  fastest.  If there are too few elements in \code{data} to fill the array,
36
  fastest.  If there are too few elements in \code{data} to fill the array,
35
  then the elements in \code{data} are recycled.  If \code{data} has
37
  then the elements in \code{data} are recycled.  If \code{data} has
36
  length zero, \code{NA} of an appropriate type is used for atomic
38
  length zero, \code{NA} of an appropriate type is used for atomic
37
  vectors (\code{0} for raw vectors) and \code{NULL} for lists.
39
  vectors (\code{0} for raw vectors) and \code{NULL} for lists.
38
 
40
 
39
  \code{as.array()} coerces its argument to be an array by attaching a
41
  \code{as.array} is a generic function for coercing to arrays.  The
40
  \code{\link{dim}} attribute to it.  It also attaches
42
  default method does so by attaching a \code{\link{dim}} attribute to
41
  \code{\link{dimnames}} if \code{x} has \code{\link{names}}.
43
  it.  It also attaches \code{\link{dimnames}} if \code{x} has
42
  The sole purpose of this is to make it possible to access the
44
  \code{\link{names}}.  The sole purpose of this is to make it possible
43
  \code{dim}[names] attribute at a later time.
45
  to access the \code{dim}[names] attribute at a later time.
44
 
46
 
45
  \code{is.array} returns \code{TRUE} or \code{FALSE} depending on
47
  \code{is.array} returns \code{TRUE} or \code{FALSE} depending on
46
  whether its argument is an array (i.e., has a \code{dim} attribute of
48
  whether its argument is an array (i.e., has a \code{dim} attribute of
47
  positive length) or not.  It is generic: you can write methods to handle
49
  positive length) or not.  It is generic: you can write methods to handle
48
  specific classes of objects, see \link{InternalMethods}.
50
  specific classes of objects, see \link{InternalMethods}.