From maechler at stat.math.ethz.ch  Sat Sep 30 16:39:04 2006
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Sat, 30 Sep 2006 16:39:04 +0200
Subject: [Rd] Strange behaviour of the [[ operator
In-Reply-To: <451DC321.2030704@fhcrc.org>
References: <451DC321.2030704@fhcrc.org>
Message-ID: <17694.33160.489389.196778@stat.math.ethz.ch>

>>>>> "Herve" == Herve Pages <hpages at fhcrc.org>
>>>>>     on Fri, 29 Sep 2006 18:06:41 -0700 writes:

    Herve> Hi,
    Herve> This looks like a bug:
hmm, maybe...
or maybe not; I vaguely recall that this is documented somewhere...

    >> a <- list(b=5)
    >> a[['b']]
    Herve> [1] 5
    >> a[[t<-'b']]

    Herve> Nothing gets printed!

Yes, but that is not really much related to "[[" 
but rather to  "<-"  which momentarily turns off auto-printing.

Similar things happen in many similar circumstances.

    Herve> I need to use parenthesis to see the expected result:

    >> a[[(t<-'b')]]
    Herve> [1] 5

    Herve> Cheers,
    Herve> H.

Martin




[Rd] Strange behaviour of the [[ operator
Martin Maechler