Next: arrays Up: MacAnova Help File Previous: arithmetic   Contents

# array()

Usage:
 ```array(x,n1,n2,...[,KeyPhrases]) or array(x,dimVec [,KeyPhrases]), x REAL, LOGICAL or CHARACTER, n1, n2, ... positive integers or dimVec a vector of positive integers, KeyPhrases can be labels:structure(lab1,lab2,...) and/or silent:T, where lab1, lab2, ... are CHARACTER scalars or vectors. KeyPhrases can be labels:structure(lab1,lab2,...), notes:Notes and silent:T, where lab1, lab2, ... and Notes are CHARACTER scalars or vectors. ```

Keywords: variables, combining variables, character variables
```array(x,dimVec) makes an array whose dimensions are the elements of
dimVec, a vector of positive integers.  The data are taken from REAL,
LOGICAL or CHARACTER variable x.  The dimensions of x are ignored, that
is, array(x,dimVec) is equivalent to array(vector(x),dimVec).  For
example, array(run(24),vector(4,3,2)) creates a 4 by 2 by 2 array.

The data from x are entered with the leftmost dimensions varying fastest
and the rightmost varying slowest.  For example, array(run(20),
vector(5,4)) is equivalent to matrix(run(20),5).

array(x,n1,n2,...) is equivalent to array(x,vector(n1,n2,...)), when n1,
n2, ...  are REAL scalars or vectors.  Most usually n1, n2, ... are
scalars, as in array(run(24),4,3,2) which creates a 4 by 3 by 2 array.

There must be exactly prod(dimVec) or prod(vector(n1, n2, ....))
elements in x.  See prod().

When x is a scalar, vector, matrix or array, array(x), with no
dimensions, is equivalent to array(x,dim(x)), that is, it returns a
variable identical to x.

You can specify coordinate labels for the output using keyword phrase
'labels:Labels'.  See topic 'labels' for details.

You can attach a CHARACTER vector Notes of descriptive notes to the
result using keyword phrase 'notes:Notes'.  See topic 'notes' for
details.

When no dimensions are specified or the new dimensions exactly match the
dimensions of x, any coordinate labels or descriptive notes of x are
transferred to the result unless 'labels' or 'notes' provide new labels
or notes or are NULL.