Re: [R] Calculate Mean from List

2010-11-09 Thread Greg Snow
You could use the "Reduce" function to get the sum of the matrices, then if there are no missing vales just divide by the number of matrices. If there are missing values then you would probably need to use Reduce again to count the number of non-missing values. Since all the matrices are the s

Re: [R] Calculate Mean from List

2010-11-09 Thread Dimitris Rizopoulos
one way is the following: A <- replicate(10, cor(matrix(rnorm(30), 10, 3)), simplify = FALSE) triA <- sapply(A, function (m) m[upper.tri(m)]) rowMeans(triA, na.rm = TRUE) I hope it helps. Best, Dimitris On 11/9/2010 9:23 AM, Suphajak Ngamlak wrote: Dear all, I have a list of correlation c