[R] Superassignment (<<-) and indexing

Brahm, David David.Brahm at geodecapital.com
Fri Sep 2 22:51:47 CEST 2005


In a clean environment under R-2.1.0 on Linux:
> x <- 1:5
> x[3] <<- 9
Error: Object "x" not found

Isn't that odd?  (Note x <<- 9 works just fine.)

Why am I doing this?  Because I'm stepping through code that
normally lives inside a function, where "<<-" is appropriate.

-- David Brahm (brahm at alum.mit.edu)




More information about the R-help mailing list