From: McGehee, Robert <Robert.McGehee_at_geodecapital.com>

Date: Wed 11 May 2005 - 00:18:38 EST

*>
*

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

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 Received on Wed May 11 00:24:56 2005

Date: Wed 11 May 2005 - 00:18:38 EST

You could try temporarily switching the list to an array, then just run
an apply on rows and columns:

*> apply(array(do.call("cbind", z), c(dim(z[[1]]), length(z))), c(1, 2),
*

mean)

Best,

Robert

-----Original Message-----

From: David Kane [mailto:dave@kanecap.com]
Sent: Tuesday, May 10, 2005 10:04 AM

To: r-help@stat.math.ethz.ch

Subject: [R] summary statistics for lists of matrices or dataframes

Is there a simple way to calculate summary statistics for all the matrices or dataframes in a list? For example:

*> z <- list(matrix(c(2,2,2,2), ncol = 2), matrix(c(4,4,4,4), ncol = 2))
**> z
*

[[1]]

[,1] [,2]

[1,] 2 2

[2,] 2 2

[[2]]

[,1] [,2]

[1,] 4 4

[2,] 4 4

*>
*

I would like to calculate, for example, the mean value for each cell. I can do that the hard way as:

[,1] [,2]

[1,] 3 3

[2,] 3 3

*>
*

Thanks,

Dave Kane

In case it matters:

*> R.version
*

arch i686 os linux-gnu system i686, linux-gnu status major 2 minor 1.0 year 2005 month 04 day 18 language R

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

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 Received on Wed May 11 00:24:56 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:31:40 EST
*