Dimnames Attribute of an Object

DESCRIPTION:
Returns or changes the dimnames attribute of an array. This is a list of the same length as the dimension of the array.

USAGE:
dimnames(x)
dimnames(x) <- value

REQUIRED ARGUMENTS:
x:
any object.

OPTIONAL ARGUMENTS:
value:
list of the same length as dim(x), or NULL.

VALUE:
the dimension names of x if they exist, or NULL.

SIDE EFFECTS:
in the assignment form the dimnames attribute of x is created or changed if x is an array or data frame and value is compatible with dim(x).

DETAILS:
This is a generic function, there is a method for data frames. Arrays (may) have a dimnames attribute, and this is what is reported on or changed. The dimnames of a data frame are the row.names attribute and the names of the object.

To explicitly delete the dimnames attribute of an array (or matrix), use dimnames(x)<-NULL. You may not remove the dimnames of a data frame and the row and column names that you give it must be unique and of non-zero length.

The dimnames of an object is a list whose length is length(dim(x)). The ith element of dimnames(x) is either of length 0 (not allowed for data frames) or is a vector of dim(x)[i] character strings, and in the latter case should be thought of as a set of labels for the ith dimension of x.


NOTE:
Array subscripts retain dimnames; see Subscript.

SEE ALSO:
dim , names , attr , attributes , array , matrix , data.frame .

EXAMPLES:
dimnames(iris)[[3]]     # iris species

dimnames(my.matrix) <- list(NULL, c("red", "brown", "purple", "silver"))