Next: shell()
Up: MacAnova Help File
Previous: setseeds()
Contents
Usage:
shapeNames <- shapeof(arg1 [, arg2 ...] [,strict:T]), arg1, arg2, ...
arbitrary variables, including macros and built-in functions.
|
Keywords:
variables
Usage
shapename <- shapeof(arg), where arg is REAL, LOGICAL, CHARACTER or
LONG, sets shapename to one of "SCALAR", "VECTOR", "MATRIX", or
"ARRAY", classifying the shape by the first of isscalar(arg),
isvector(arg), ismatrix(arg) or isarray(arg) to be true.
When arg is not REAL, LOGICAL, CHARACTER, or LONG, shapeof(arg) returns
one of "STRUCTURE", "MACRO", "FUNCTION", "GRAPH", "UNDEFINED" or "NULL"
just as does typeof(arg).
shapename <- shapeof(arg, strict:T) does the same, except "SCALAR" and
"VECTOR" are returned only when ndims(arg) = 1 and "MATRIX" is returned
only when ndims(arg) = 2.
shapenames <- shapeof(arg1, arg2 ... [,strict:T]), where arg1, arg2,
... are any variables, makes shapenames a CHARACTER vector with
length(shapenames) = number of arguments, with shapenames[i] the name of
the shape of argument i.
Examples
Examples:
Cmd> a <- sqrt(2); shapeof(a)
(1) "SCALAR"
Cmd> b <- matrix(run(4),4); shapeof(b)
(1) "VECTOR"
Cmd> shapeof(b,strict:T)
(1) "MATRIX"
Cmd> shapeof(run(4)) == shapeof(b) # compare shapes
(1) T
Cmd> shapeof(run(4),strict:T) == shapeof(b,strict:T) # compare shapes
(1) F
Cmd> shapeof(array(PI,1,1,1),help,NULL,T,cos,strict:T)
(1) "ARRAY"
(2) "MACRO"
(3) "NULL"
(4) "SCALAR"
(5) "FUNCTION"
Cross references
See also topics nameof(), typeof(), isarray(), ischar(), isdefined(),
isfactor(), isfunction(), isgraph(), islogic(), ismacro(), ismatrix(),
isname(), isnull(), isnumber(), isreal(), isscalar(), isvector().
Gary Oehlert
2005-08-12