Re: [R] averaging two matrices whilst ignoring missing values

2009-07-14 Thread Bill.Venables
-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Moshe Olshansky [m_olshan...@yahoo.com] Sent: 14 July 2009 13:55 To: r-help@r-project.org; Tish Robertson Subject: Re: [R] averaging two matrices whilst ignoring missing values One (awkward) way to do this is: x - matrix(c(c(test),c

[R] averaging two matrices whilst ignoring missing values

2009-07-13 Thread Tish Robertson
Hi folks, I'm trying to do something that seems like it should easy, but it apparently isn't. I have two large matrices, both containing a number of missing values at different cells. I would like to average these matrices, but the NAs are preventing me. I get a non-numeric argument to

Re: [R] averaging two matrices whilst ignoring missing values

2009-07-13 Thread Rolf Turner
On 14/07/2009, at 1:46 PM, Tish Robertson wrote: Hi folks, I'm trying to do something that seems like it should easy, but it apparently isn't. I have two large matrices, both containing a number of missing values at different cells. I would like to average these matrices, but the NAs

Re: [R] averaging two matrices whilst ignoring missing values

2009-07-13 Thread Moshe Olshansky
One (awkward) way to do this is: x - matrix(c(c(test),c(test2)),ncol=2) y - rowMeans(x,na.rm=TRUE) testave - matrix(y,nrow=nrow(test)) --- On Tue, 14/7/09, Tish Robertson tishrobert...@hotmail.com wrote: From: Tish Robertson tishrobert...@hotmail.com Subject: [R] averaging two matrices