[R] Re: cannot assign dimnames
Gabor Grothendieck
ggrothendieck at myway.com
Mon Sep 27 21:54:28 CEST 2004
Dan Bebber <danbebber <at> forestecology.co.uk> writes:
: Please ignore my earlier message on this topic. I was under the mistaken
: impression that dimnames() named the dimensions themselves, rather than the
: indices within the dimensions.
What you are referring to is done in R by referring to the names of
the dimnames, as opposed to the dimnames, themselves. Here is an
example:
R> mat <- matrix(1:12,4, dimnames = list(letters[1:4],LETTERS[1:3]))
R> names(dimnames(mat)) <- c("FirstDim", "SecondDim")
R> mat
SecondDim
FirstDim A B C
a 1 5 9
b 2 6 10
c 3 7 11
d 4 8 12
More information about the R-help
mailing list