See ?upper.tri and ?lower.tri.

On Fri, Nov 21, 2008 at 1:05 PM, A Ezhil <ezhil02@yahoo.com> wrote:

> 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 <P.Dalgaard@biostat.ku.dk> wrote:
>
> > From: Peter Dalgaard <P.Dalgaard@biostat.ku.dk>
> > Subject: Re: [R] Extracting diagonal matrix
> > To: Rory.WINSTON@rbs.com
> > Cc: ezhil02@yahoo.com, r-help@r-project.org
> > Date: Friday, November 21, 2008, 6:23 PM
> > Rory.WINSTON@rbs.com 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: r-help-bounces@r-project.org
> > [mailto:r-help-bounces@r-project.org] 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
> > ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)              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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]

