Re: [Rd] Strange behavior of assign in a S4 method.

2010-03-16 Thread Christophe Genolini
Dear Wolfgang, Thanks for the showMethod and the link. Perhaps juggling with the 'n' argument of 'parent.frame' could help in hacking something together that 'works' I just change the argument list of foo2 to perfectly match with the definition. but as far as I can see what you want to is an

Re: [Rd] Strange behavior of assign in a S4 method.

2010-03-16 Thread Prof Brian Ripley
Where did you get the idea that 'x' comes from the parent frame? There is no guarantee of this, and you are relying on/stumbling over implementation details here. (An extra call is inserted by setMethod() to handle the matching up of argumnets, but that is something which may change, and has

Re: [Rd] Strange behavior of assign in a S4 method.

2010-03-15 Thread Wolfgang Huber
Dear Christophe type showMethods("foo1", inc=TRUE) showMethods("foo2", inc=TRUE) to see the difference between the two functions, and this will explain their different behaviour. This feature of S4 has been discussed here many times before, see e.g.: http://tolstoy.newcastle.edu.au/R/e4/help

[Rd] Strange behavior of assign in a S4 method.

2010-03-15 Thread Christophe Genolini
Hi the list, I define a method that want to change an object without assignation (foo(x) and not x<-foo(x)) using deparse and assign. But when the argument of the method does not match *exactly* with the definition of the generic function, assign does not work... Anything wrong? Christophe #-