[R] Extracting eg A[, , 3, 1, ] from an array but using dimension names and levels

Søren Højsgaard Soren.Hojsgaard at agrsci.dk
Thu Aug 21 01:16:08 CEST 2008


Consider the extraction
 
> HairEyeColor[,3,1]
Black Brown   Red Blond 
   10    25     7     5 

Suppose I have the appropriate dimensions and levels given as variables, e.g.
d1 <-2
l1 <-3 
d2 <-3
l2 <-1

How can I then make the "extraction" above using d1, l1, d2, l2  (for an array of arbitrary dimension)?
 
Best regards
Søren
 



More information about the R-help mailing list