On Wed, 2007-11-21 at 14:30 -0500, Gregory Gentlemen wrote:
> Hello fellow R users,
>
> I have a matrix computation that I imagine should be relatively easy
> to do, however I cannot figure out a nice way to do it. I have two
> matrices, for example
>
> mat1 <- matrix(c(1:5,rep(NA,5), 6:10), nro
Maybe there is a more elegant solution, but here is one possibility:
mat1[is.na(mat1)]<-mat2[is.na(mat1)]
mat2[is.na(mat2)]<-mat1[is.na(mat2)]
(mat1+mat2)/2
On Nov 21, 2007 12:30 PM, Gregory Gentlemen <[EMAIL PROTECTED]> wrote:
> Hello fellow R users,
>
> I have a matrix computation that I imagi
Hello fellow R users,
I have a matrix computation that I imagine should be relatively easy to do,
however I cannot figure out a nice way to do it. I have two matrices, for
example
mat1 <- matrix(c(1:5,rep(NA,5), 6:10), nrow=3, byrow=T)
mat2 <- matrix(c(2:6, 6:10, rep(NA,5)), nrow=3, byrow=T)
I
3 matches
Mail list logo