From hpages at fhcrc.org  Mon Oct  2 22:21:45 2006
From: hpages at fhcrc.org (Herve Pages)
Date: Mon, 02 Oct 2006 13:21:45 -0700
Subject: [Rd] More strange [[ behaviour
In-Reply-To: <45216C53.4040803@stats.uwo.ca>
References: <452166BB.3040901@fhcrc.org> <45216C53.4040803@stats.uwo.ca>
Message-ID: <452174D9.60408@fhcrc.org>

Duncan Murdoch wrote:
> On 10/2/2006 3:21 PM, Herve Pages wrote:
>>> a[[x=1]]
>> Error in a[[x = 1]] : subscript out of bounds
>>
>
> Indexing is a function call, with arguments x, i, j, ... .  If you use
> y=1, you're setting something in the "..." part of the arg list.  If
> you say x=1, you're setting the first arg, but because a[[x=1]] is the
> same as "[["(a, x=1), it is going to evaluate it as "[["(x=1, i=a) and
> try to index 1 by a instead of a by 1.
Hi Duncan,

Right, thanks for the explanation and sorry for not paying more
attention.

Best,
H.




[Rd] More strange [[ behaviour
Herve Pages