On Thu, Jan 22, 2009 at 3:06 PM, Duncan Murdoch <murd...@stats.uwo.ca> wrote: > > get("<-") will give it to you, and > > `<-` <- function(x, y) cat("x=", x, "y=", y, "\n") > > will change it -- and will probably be the last effective thing you do in > that session, unless you're really careful: > >> x <- 1 >> x > [1] 1 >> `<-` <- function(x, y) cat("x=", x, "y=", y, "\n") >> x <- 3 > x= 1 y= 3 >> x > [1] 1 >> # now what?? &%#* >> q("no") > > Duncan Murdoch >
Thanks for the replies! Actually I have thought about this; what I plan to do is: oldAssign <- `<-` oldAssign(`<-`, function(x,value){if (...) do_something; oldAssign(x,value)}) x<-1 x # object not found!! So the problem now is the effect of oldAssign(x,value) is only local--within that anonymous function. Is there a way to do assignInNamespace (or how to get the namespace where the overridden <- is called)? ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.