[R-SIG-Mac] generate matrix of matrices

Felipe Zapata felipe.zapata at umsl.edu
Sun Feb 21 08:02:21 CET 2010


A general question for R users about matrix manipulation:

I have two symmetric distance matrices (measuring distances in 2  
different variables) and I am trying to build a new matrix showing one  
half of one of the matrices (below diagonal) and the other half of  
other matrix (above he diagonal). Is there any R function to do this??  
any help would be appreciated.

This is what i am talking about

The matrices I have:

matrix 1:
	[1]	[2]	[3]
[1]	0	a	b
[2]	a	0	c
[3]	b	c	0

matrix 2
	[1]	[2]	[3]
[1]	0	x	y
[2]	x	0	z
[3]	y	z	0

The matrix I want
	[1]	[2]	[3]
[1]	0	a	b
[2]	x	0	c
[3]	y	z	0

Thanks,

FZ.



More information about the R-SIG-Mac mailing list