What does the "<<-" operator mean?
On Fri, Apr 22, 2011 at 9:39 AM, Rolf Turner <rolf.turner at xtra.co.nz> wrote:
On 22/04/11 07:08, Cliff Clive wrote:
I've been reading some code from an example in a blog post ( http://www.maxdama.com/ here ) and I came across an operator that I hadn't seen before. ?The author used a<<- operator to update a variable, like so: ecov_xy<<- ecov_xy+decay*(x[t]*y[t]-ecov_xy) At first I thought it was a mistake and tried replacing it with the usual<- assignment operator, but I didn't get the same results. ?So what does the double arrow<<- operator do?
Install the "fortunes" (if you haven't already) and see:
? ?fortune("<<-")
But note that in the quote Bill says "R/S" and it's dated 2001, so
it's primarily based on experience with S. In S you don't have
enclosing environments so only the Evil and Wrong uses of
superassignment are possible.
-thomas
Thomas Lumley Professor of Biostatistics University of Auckland