Skip to content
Back to formatted view

Raw Message

Message-ID: <1073898950.400265c685da0@webmail.han.nl>
Date: 2004-01-12T09:15:50Z
From: W. Beldman
Subject: Matrix indexes

Two questions about matrix indexing:

Is is correct that   V <- V[lower.tri(V, diag=TRUE)]   returns the lower 
triangular of matrix V, that is: all elements above diagonal are set to zero? I 
understand that the triangle of matrix elements of V for which lower.tri is 
TRUE are returned while the others (above diagonal) are set to zero (or NA ???).



If D and B are vectors of logicals,
what does  V  contain after   V <- v[D, B, drop=FALSE]   ?
I guess that elements are returned if both indexes D and B are TRUE, but I'm 
not really convinced... (And again, what about the other elements?)




These are probably tutorial questions, but I'm still not sure after reading "R 
Language Definition (draft): Evaluation of expressions" and applicable sections 
of "The R Reference Manual". Thanx!

W. Beldman