[Rd] overwriting '<-' and infinite recursions

Yi Zhang yizhang84 at gmail.com
Fri Jan 23 21:41:25 CET 2009


Hello all,

I'm having a problem when overwriting the '<-' function and was told
I'd better post it here for help. The reason why I need to overwrite
it is complicated and not easy to tell in a few words; but this seems
the only clean option other than hacking R's core source code. My code
looks like:

# in .onLoad of a package; or if you want to test, put it in a function
env <- as.environment('package:base')
unlockBinding('<-',env)
assign('<-', newAssign, envir=env)
.Internal(lockBinding(as.name('<-'), env))
 #not using lockBinding directly because it calls '<-'

It gave me this error: Error: evaluation nested too deeply: infinite
recursion / options(expressions=)?

Any suggestion is appreciated!

-- 
Yi



More information about the R-devel mailing list