hi all. how can i adress a array directly. for example i wanna give array 1 other labels than array 2. How can I overcome this problem? ...this doesn't work tab <- array(1:8, c(2, 2, 2)) dimnames(tab[,,1]) <- list(c("No","Yes"), c("No","Yes"),c("ARRAY1")) dimnames(tab[,,2]) <- list(c("big","small"), c("small","big"),c("ARRAY2")) -- View this message in context: http://www.nabble.com/-R--accessing-arrays-tf2913929.html#a8142071 Sent from the R help mailing list archive at Nabble.com.
try this : x <- array(1:24,dim=c(2,3,4),dimnames=list(letters[1:2],LETTERS[1:3],letters[23:26])) Cheers, Wolfgang downunder03 a ?crit :> hi all. how can i adress a array directly. for example i wanna give array 1 > other labels than array 2. How can I overcome this problem? > > ...this doesn't work > > tab <- array(1:8, c(2, 2, 2)) > dimnames(tab[,,1]) <- list(c("No","Yes"), c("No","Yes"),c("ARRAY1")) > dimnames(tab[,,2]) <- list(c("big","small"), c("small","big"),c("ARRAY2")) > > > >. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Wolfgang Raffelsberger, PhD Laboratoire de BioInformatique et G?nomique Int?gratives IGBMC 1 rue Laurent Fries, 67404 Illkirch Strasbourg, France Tel (+33) 388 65 3314 Fax (+33) 388 65 3276 wolfgang.raffelsberger at igbmc.u-strasbg.fr
You can't do that. If you want to have different labels on the first two dimensions, then a 3-dimensional array doesn't seem to be the natural data structure. I would suggest two matrices held in a list. Patrick Burns patrick at burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and "A Guide for the Unwilling S User") downunder03 wrote:>hi all. how can i adress a array directly. for example i wanna give array 1 >other labels than array 2. How can I overcome this problem? > >...this doesn't work > >tab <- array(1:8, c(2, 2, 2)) >dimnames(tab[,,1]) <- list(c("No","Yes"), c("No","Yes"),c("ARRAY1")) >dimnames(tab[,,2]) <- list(c("big","small"), c("small","big"),c("ARRAY2")) > > > > >
Apparently Analagous Threads
- alternatives to traditional least squares method in linear regression ?
- optimizing speed of calculation (recursive product)
- how to make a function recognize the name of an object/vector given as argument
- require() is not giving TRUE / FALSE statements ?
- Don't find a package !