Hi,

I need some help

I have a matrix M(m,n) in which each element is a vector V of lenght 6
 1      2      3      4      5      6      7
1   List,6 List,6 List,6 List,6 List,6 List,6 List,6
2   List,6 List,6 List,6 List,6 List,6 List,6 List,6
3   List,6 List,6 List,6 List,6 List,6 List,6 List,6
4   List,6 List,6 List,6 List,6 List,6 List,6 List,6


i would like to make the sum on the matrix of each element of the
matrix, that is to say 
sum(on the matrix)(M[j,][[j]][[1]])
sum(on the matrix)(M[j,][[j]][[2]])
...
sum(on the matrix)(M[j,][[j]][[6]])  

I don't really know how to do.
I thought it was possible to transform the matrix M into an array A of
dimension (m,n,6), and then use the command sum(colsums(A[,,1]), which
seems to be possible and quite fast.
...but I don't know how to convert a matrix of vector into an array....

As anyone any little idea about that ?

Thanks by advance

Jessica

______________________________________________
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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to