Dear all,
I have a list of arrays and I would like to produce a
list of all the values in the arrays along with the
names of the values and the other dimension names. For
example, I have arrays
my.arrays <- list(array(rnorm(720, 10, 2), 8:10),
array(rnorm(336, 20, 6), 6:8), array(rnorm(120, 7, 1),
4:6))
with dimension names
dimnames(my.arrays[[1]]) <- list(LETTERS[1:8],
LETTERS[6:14], LETTERS[17:26])
dimnames(my.arrays[[2]]) <- list(LETTERS[1:6],
LETTERS[7:13], LETTERS[14:21])
dimnames(my.arrays[[3]]) <- list(LETTERS[5:8],
LETTERS[10:14], LETTERS[16:21])
I can produce a list of all the values, values- column
mean and the name of the value, i.e.
unlist(lapply(seq(length(my.arrays)), function(k,
my.arrays) {apply(my.arrays[[k]], c(2,3), function(x)
{
x.mean <- mean(x)
cbind(paste(round(x,3), round(x-x.mean,3),
names(x)))
})
}, my.arrays))
What I would like is the names of the other two
dimensions in the list, e.g. first component
"11.713 0.984 A F Q" instead of
"11.713 0.984 A"
Is this possible using the apply command as it doesn't
track the indices of the other dimensions?
Thanks in advance for any help.
Dave
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
|