Hello, R users! As a geneticist, and new user of R are still find some basic questions hard to solve. For example, I am trying to understand a code, which uses, for instance, a matrix of correlations:
>mymatrix [,1] [,2] [,3] [,4] [,5] [1,] 1.0000000 0.2500000 0.2357023 0.2182179 0.2721655 [2,] 0.2500000 1.0000000 0.3535534 0.3273268 0.4082483 [3,] 0.2357023 0.3535534 1.0000000 0.3086067 0.3849002 [4,] 0.2182179 0.3273268 0.3086067 1.0000000 0.3563483 [5,] 0.2721655 0.4082483 0.3849002 0.3563483 1.0000000 So far, so good. I understand well what this matrix means. Then, the following line shows up: solved<- diag(solve(mymatrix)) > solved [1] 1.131429 1.325714 1.285714 1.240000 1.388571 would it be possible to you please, to send me some comments on what that command does, and where I might learn the math behind it? Thank you very much in advance. All the best, Tiago -- View this message in context: http://r.789695.n4.nabble.com/What-does-the-command-diag-solve-matrix-do-tp3445982p3445982.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.