Nope, I was sloppy and missed that. Thanks

... forwarding to list and OP

Michael

On Mon, Sep 26, 2011 at 4:26 PM, William Dunlap <wdunlap@tibco.com> wrote:

> My r-help mail is arriving out of order, so perhaps
> you have already corrected this, but you need a call
> to t() to make this work.  Your solution does not
> give a symmetric matrix (which I think the OP wants):
>   > test[lower.tri(test)] <- test[upper.tri(test)]
>  > print(test)
>        [,1] [,2] [,3] [,4]
>  [1,]   NA    1    2    3
>  [2,]    1   NA    4    5
>  [3,]    2    3   NA    6
>  [4,]    4    5    6   NA
> but the following does
>  > test[lower.tri(test)] <- t(test)[upper.tri(test)]
>  > print(test)
>       [,1] [,2] [,3] [,4]
>  [1,]   NA    1    2    3
>  [2,]    1   NA    4    5
>  [3,]    2    4   NA    6
>  [4,]    3    5    6   NA
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
> > -----Original Message-----
> > From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-project.org]
> On Behalf Of R. Michael
> > Weylandt
> > Sent: Monday, September 26, 2011 1:10 PM
> > To: m.marcinmichal; r-help
> > Subject: Re: [R] Triangular matrix upper to down
> >
> > On Mon, Sep 26, 2011 at 4:09 PM, R. Michael Weylandt <
> > michael.weylandt@gmail.com> wrote:
> >
> > > How about: test[lower.tri(test)] <- test[upper.tri(test)]
> > >
> > > Try it with this data so you can see that it actually works: (the ones
> > > obscure possible false solutions)
> > >
> > >
> > > test <- matrix(ncol = 4, nrow = 4)
> > >  test[1, ] <-  c(NA,1,2,3)
> > > test[2, ] <-  c(NA,NA,4,5)
> > > test[3, ] <-  c(NA,NA,NA,6)
> > >
> > > test[4, ] <-  c(NA,NA,NA,NA)
> > >
> > > print(test)
> > > test[lower.tri(test)] <- test[upper.tri(test)]
> > > print(test)
> > >
> > > Hope this helps,
> > >
> > > Michael Weylandt
> > >
> > >
> > >
> > > On Mon, Sep 26, 2011 at 3:50 PM, m.marcinmichal <
> m.marcinmichal@gmail.com>wrote:
> > >
> > >> Hi,
> > >> suppose that we have a triangular upper matrix A
> > >>
> > >> test <- matrix(ncol = 4, nrow = 4)
> > >> test[1, ] <-  c(NA,1,1,1)
> > >> test[2, ] <-  c(NA,NA,1,1)
> > >> test[3, ] <-  c(NA,NA,NA,1)
> > >> test[4, ] <-  c(NA,NA,NA,NA)
> > >>
> > >> I know how quickly set diagonal value diag(test) <- 1. But how quickly
> set
> > >> down value i.e. matrix is symmetrical? Is there in r project any
> quickly
> > >> function?
> > >>
> > >> Thanks,
> > >>
> > >> Best
> > >>
> > >> Marcin
> > >>
> > >> --
> > >> View this message in context:
> > >>
> http://r.789695.n4.nabble.com/Triangular-matrix-upper-to-down-tp3845107p3845107.html
> > >> Sent from the R help mailing list archive at Nabble.com.
> > >>
> > >> ______________________________________________
> > >> 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.
> > >>
> > >
> > >
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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.
>

	[[alternative HTML version deleted]]

