On Tue, 2007-07-31 at 19:03 +0100, Garavito,Fabian wrote:
> Can I assign names to rows/columns in a i x k x j matrix / dataframe?

You can use an array:

ARR <- array(1:18, c(3, 3, 3), 
             dimnames = list(LETTERS[1:3], LETTERS[4:6], LETTERS[7:9]))

> ARR
, , G

  D E F
A 1 4 7
B 2 5 8
C 3 6 9

, , H

   D  E  F
A 10 13 16
B 11 14 17
C 12 15 18

, , I

  D E F
A 1 4 7
B 2 5 8
C 3 6 9


> ARR["B", "E", "H"]
[1] 14


See ?array

By definition, matrices and dataframes are two dimensional, though you
can have a list containing N of them.

HTH,

Marc Schwartz

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to