[R] diagonal matrix construction

2004-10-12 Thread Chris Ryan
Hi, I have worked long and hard and looked in the manuals and am having a hard time constructing a diagonal matrix. I can get the diagonals out of a matrix but can't construct the matrix with just the diagonals. I have been on the web site and manuals and I think that it says to use: dsj

Re: [R] diagonal matrix construction

2004-10-12 Thread Gabor Grothendieck
Chris Ryan chrisryan at wvdnr.gov writes: : : Hi, : : I have worked long and hard and looked in the manuals and am having a hard time constructing a diagonal : matrix. I can get the diagonals out of a matrix but can't construct the matrix with just the diagonals. I : have been on the web

Re: [R] diagonal matrix construction

2004-10-12 Thread Spencer Graves
Did you try working the examples in the diag documentation, one of which is as follows: diag(10,3,4) # guess what? [,1] [,2] [,3] [,4] [1,] 10000 [2,]0 1000 [3,]00 100 (R 1.9.1 for Windows). The R syntax expects three in that