Skip to content
Back to formatted view

Raw Message

Message-ID: <23607694.post@talk.nabble.com>
Date: 2009-05-19T00:40:27Z
From: dxc13
Subject: how to calculate means of matrix elements

useR's,
I have several matrices of size 4x4 that I want to calculate means of their
respective positions with.  For example, consider I have 3 matrices given by
the code:
mat1 <- matrix(sample(1:20,16,replace=T),4,4)
mat2 <- matrix(sample(-5:15,16,replace=T),4,4)
mat3 <- matrix(sample(5:25,16,replace=T),4,4)

The result I want is one matrix of size 4x4 in which position [1,1] is the
mean of position [1,1] of the given three matrices.  The same goes for all
other positions of the matrix.  If these three matrices are given in
separate text files, how can I write code that will get this result I need?

Thanks in advance,
dxc13
-- 
View this message in context: http://www.nabble.com/how-to-calculate-means-of-matrix-elements-tp23607694p23607694.html
Sent from the R help mailing list archive at Nabble.com.