dim(x) dim(x) <- value
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