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?  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=
> one must store the result of that expression in a variable, x, first:
>
>   x <- outer(1:6, 1:6, "+")
>   x[lower.tri(x)]
>
> but with the proposed value= argument one could just use function
> composition:
>
>   lower.tri(outer(1:6, 1:6, "+"), value = TRUE)
>
> 2. the whole object approach of R encourages working with the objects
> themselves rather than indexes and value= is consistent with that.
>
>

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to