Re: [Rd] proposal for lower.tri and upper.tri value argument

2006-08-06 Thread Patrick Burns
Gabor came close to the situation I had yesterday that prompted me to write a local version of 'lower.tri'. It was approximately: x[sub, sub][lower.tri(x[sub,sub])] Pat Gabor Grothendieck wrote: > On 8/6/06, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > >> Is there a case to be made for this?

Re: [Rd] proposal for lower.tri and upper.tri value argument

2006-08-06 Thread Gabor Grothendieck
On 8/6/06, Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > Is there a case to be made for this? If so, where is it? > > (I don't find x[lower.tri(x)] harder to write than lower.tri(x, > value=TRUE), and wonder why you do? The reasons are 1. x might be the result of an expression. Without value=

Re: [Rd] proposal for lower.tri and upper.tri value argument

2006-08-06 Thread Prof Brian Ripley
Is there a case to be made for this? If so, where is it? (I don't find x[lower.tri(x)] harder to write than lower.tri(x, value=TRUE), and wonder why you do? For grep, one can argue that handling empty sets is clearer with value=, but I have seen quite a few uses where that is not used and cou

[Rd] proposal for lower.tri and upper.tri value argument

2006-08-05 Thread Patrick Burns
I propose that a 'value' argument be added to 'lower.tri' and 'upper.tri'. This is analogous to the 'value' argument of 'grep'. Something like the following should work: > upper.tri function (x, diag = FALSE, value = FALSE) { x <- as.matrix(x) if (diag) ans <- row(x) <= col(x)