Skip to content
Prev 69454 / 398513 Next

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:
[[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
But there must be an easier way. I am also interested in other
statistics (like median and sd). Since all my matrices have the same
attributes (especially row and column names), I would like to preserve
those in the answer.

Thanks,

Dave Kane

In case it matters:
_                
platform i686-pc-linux-gnu
arch     i686             
os       linux-gnu        
system   i686, linux-gnu  
status                    
major    2                
minor    1.0              
year     2005             
month    04               
day      18               
language R