[Rd] Using substitute from inside an S4 method

2006-12-13 Thread Franck Arnaud
Hi all, I don't understand why this does not what I expect : ## code start here ## setClass("num",representation(x="numeric")) num<-function(x) new("num",x=x) add<-function(e1,e2) { cat("Computing ",deparse(substitute(e1)),"+",deparse(substitute(e2)),"\n") [EMAIL PROTECTED]@x

Re: [Rd] Using substitute from inside an S4 method

2006-01-25 Thread bill
On Wed, 25 Jan 2006, Seth Falcon wrote: > I would like to access the name of a variable passed to an S4 method. > For a function, I would do this: > > f <- function(x) as.character(substitute(x)) > > This also works for a the examples I have tried for methods that do > not have extra, non-disp

Re: [Rd] Using substitute from inside an S4 method

2006-01-25 Thread Gabor Grothendieck
Try defining your method like this. I don't know how generally this works but it seems to work here. setMethod("A", signature(x="numeric"), function(x, y) as.character(substitute(x, sys.frame(-1 On 1/25/06, Seth Falcon <[EMAIL PROTECTED]> wrote: > Hi all, > > I would like to ac

[Rd] Using substitute from inside an S4 method

2006-01-25 Thread Seth Falcon
Hi all, I would like to access the name of a variable passed to an S4 method. For a function, I would do this: f <- function(x) as.character(substitute(x)) This also works for a the examples I have tried for methods that do not have extra, non-dispatch args: setGeneric("A", function(x,