Thanks. I would like to extract all the matrix entries below or above the diagnol. diag(x) simply gives diagonal elements.
Thanks. Kind regards, Ezhil --- On Fri, 11/21/08, Peter Dalgaard <[EMAIL PROTECTED]> wrote: > From: Peter Dalgaard <[EMAIL PROTECTED]> > Subject: Re: [R] Extracting diagonal matrix > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED], r-help@r-project.org > Date: Friday, November 21, 2008, 6:23 PM > [EMAIL PROTECTED] wrote: > > Try > > > > ?diag > > > Or, if he really means the diagonal of a 100x100 > correlation matrix, > > rep(1,100) > > :-) > > > > > > Rory Winston > > RBS Global Banking & Markets > > Office: +44 20 7085 4476 > > > > -----Original Message----- > > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of A Ezhil > > Sent: 21 November 2008 12:28 > > To: r-help@r-project.org > > Subject: [R] Extracting diagonal matrix > > > > Dear All, > > > > I have a correlation matrix of size 100 x 100 and > would like to extract the diagonal matrix from it. I have > used the for loop to store tha correlation values of the > diagonal matrix. Is there a 'R way' of doing this? > > > > Thanks in advance. > > > > Kind regards, > > Ezhil > > > -- > O__ ---- Peter Dalgaard Ă˜ster Farimagsgade > 5, Entr.B > c/ /'_ --- Dept. of Biostatistics PO Box 2099, > 1014 Cph. K > (*) \(*) -- University of Copenhagen Denmark > Ph: (+45) 35327918 > ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: > (+45) 35327907 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.