dim
attribute, which describes the dimensions of
a matrix, data frame,
bdFrame
, or array.
dim(x) dim(x) <- value
x
(missing values are not
allowed), or
NULL
.
x
, if any; and
NULL
if
x
does
not have dimensions.
dim(x)
establishes or changes the
dim
attribute of
x
if it is an array or matrix;
no re-ordering of the elements of
x
is implied.
If the object had
names
(a
"names"
attribute) they are currently deleted.
This is a generic function,
dim
has a method for data frames and
bdFrame
s, which
counts the length of the
row.names
attribute and the number of columns.
You may not change the dimensions of a data frame or
bdFrame
.
Arrays and matrices have a
dim
attribute which is an integer vector,
with the property that
prod(dim(x))==length (x)
.
This attribute identifies an object as an array.
dim(iris) # returns c(50, 4, 3) length(dim(y)) # number of dimensions of y if(!is.null(dim(z))) { .. z .. } # do not operate on non-array data if(is.array(z)) { .. z .. } # better way to do the same thing