Re: [R] minor diagonal in R

2010-09-07 Thread Peng, C
"diag" has 4 letters "cbind" has 5 letters :) -- View this message in context: http://r.789695.n4.nabble.com/minor-diagonal-in-R-tp2529676p2529746.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

Re: [R] minor diagonal in R

2010-09-07 Thread Gabor Grothendieck
On Tue, Sep 7, 2010 at 9:09 AM, Trafim Vanishek wrote: > Dear all, > > seems that easy question but cannot find the function for that. > How to get the elements of the minor diagonal of the matrix? > Here are a few possibilities: # test matrix x <- matrix(1:16, 4) # 1 diag(x[, nrow(x):1]) # 2

Re: [R] minor diagonal in R

2010-09-07 Thread Berwin A Turlach
On Tue, 7 Sep 2010 06:26:09 -0700 (PDT) "Peng, C" wrote: > > This this what you want? > > > A=matrix(1:16,ncol=4) > > A > [,1] [,2] [,3] [,4] > [1,]159 13 > [2,]26 10 14 > [3,]37 11 15 > [4,]48 12 16 > > diag(A[1:4,4:1]) > [1] 13 10 7 4

Re: [R] minor diagonal in R

2010-09-07 Thread Peng, C
This this what you want? > A=matrix(1:16,ncol=4) > A [,1] [,2] [,3] [,4] [1,]159 13 [2,]26 10 14 [3,]37 11 15 [4,]48 12 16 > diag(A[1:4,4:1]) [1] 13 10 7 4 > -- View this message in context: http://r.789695.n4.nabble.com/minor-diagonal-

[R] minor diagonal in R

2010-09-07 Thread Trafim Vanishek
Dear all, seems that easy question but cannot find the function for that. How to get the elements of the minor diagonal of the matrix? Thanks a lot. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch