[R] assigment operator question

Mark Heckmann mark.heckmann at gmx.de
Sat Apr 7 22:30:58 CEST 2012


Hello,

using the <<- assignment operator I do not understand why the following does not work.

l <<- list()
l
list()
l$arg1 <<- "test"
error in l$arg1 <<- "test" : Objekt 'l' not found

?"<<-" says:  "The operators <<- and ->> cause a search to made through the environment for an existing definition of the variable being assigned. If such a variable is found (and its binding is not locked) then its value is redefined, otherwise assignment takes place in the global environment. "

Still I do noch understand why the above does not work. The object l is in the global environment. Can someone explain it to me?

Thanks
--Mark
––––––––––––––––––––––––––––––––––––
Mark Heckmann
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com



More information about the R-help mailing list