On Mon, Sep 26, 2011 at 4:09 PM, R. Michael Weylandt < michael.weyla...@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.marcinmic...@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.