Re: [R] splitting a square symmetric matrix

2011-01-20 Thread RICHARD M. HEIBERGER
It looks like you might be asking for this. This gets the "lower right" diagonal. > mat <- matrix(c(1,4,3,4,1,2,3,2,1), nrow = 3, ncol=3, byrow=TRUE) > mat [,1] [,2] [,3] [1,]143 [2,]412 [3,]321 > diag(mat[rev(2:nrow(mat)),-1]) [1] 2 2 > This gets the uppe

Re: [R] splitting a square symmetric matrix

2011-01-20 Thread Erik Iverson
Joe P King wrote: So many matrices are square symmetrical (i.e. variance-covariance matrices), is there any way to get R to split the matrix on its diagonal and just return one diagonal? mat<-matrix(c(1,4,3,4,1,2,3,2,1), nrow = 3, ncol=3, byrow=TRUE) is there anyway to get the lower rig

[R] splitting a square symmetric matrix

2011-01-20 Thread Joe P King
So many matrices are square symmetrical (i.e. variance-covariance matrices), is there any way to get R to split the matrix on its diagonal and just return one diagonal? So if I have mat<-matrix(c(1,4,3,4,1,2,3,2,1), nrow = 3, ncol=3, byrow=TRUE) is there anyway to get the lower right di