dim {base} | R Documentation |
Retrieve or set the dimension of an object.
dim(x);
The functions dim and dim<-
are internal generic primitive functions.
Dim has a method For data.frames
, which returns the lengths Of the
row.names
attribute Of x And Of x (As the numbers Of rows And columns
respectively).
For the default method, either NULL or a numeric vector, which is
coerced to integer (by truncation).
For an array (and hence in particular, for a matrix) dim retrieves
the dim attribute of the object. It is NULL
or a vector of mode
integer.
The replacement method changes the "dim" attribute (provided the New
value Is compatible) And removes any "dimnames" And "names"
attributes.