[R] Extracting diagonal matrix

Stavros Macrakis macrakis at alum.mit.edu
Fri Nov 21 16:22:47 CET 2008


You can also do it from first principles:

    outer(1:100,1:100,`<`) * m

which generalizes nicely to >, <=, >=, !=, etc.

           -s

On 11/21/08, Henrique Dallazuanna <wwwhsd at gmail.com> wrote:
> See ?upper.tri and ?lower.tri.



More information about the R-help mailing list