Displaying 3 results from an estimated 3 matches for "matsums".
Did you mean:
matsui
2005 Mar 16
8
Summing up matrices in a list
Dear all,
I think that my question is very simple but I failed to solve it.
I have a list which elements are matrices like this:
>mylist
[[1]]
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
[[2]]
[,1] [,2] [,3]
[1,] 7 9 11
[2,] 8 10 12
I'd like to create a matrix M<-mylist[[1]]+mylist[[2]]
[,1] [,2] [,3]
[1,] 8 12 16
[2,] 10 14 18
2005 May 10
4
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
2008 Jun 04
4
sum of unknown number of matrices
Hi R,
I have a list of matrices. I need to get the sum of all the matrices in
the list.
Example:
a=b=c=d=matrix(1:4,2,2)
l=list(a,b,c,d)
I need:
> a+b+c+d
[,1] [,2]
[1,] 4 12
[2,] 8 16
Something like do.call("+",l) is not working...why is this?
I may not be knowing the number of matrices in the list...
Thanks, Shubha
This e-mail