Re: [Rd] Attributes of 1st argument in ...

2010-07-05 Thread Daniel Murphy
I stand corrected. It is possible for the S4 cbind to know the symbol of unnamed arguments, by "cheating": colnames(base::cbind(...,deparse.level = deparse.level)) -- which tells me that there ought to be a non-cheating way. I note that the Rmpfr class union, Mnumber, means that the simple cbind(1

Re: [Rd] Attributes of 1st argument in ...

2010-07-05 Thread Daniel Murphy
I truly am grateful for all the help. I never would have thought defining a class union for objects that can be combined with cbind, as you do in Rmpfr. That does the trick. Is it true that the only difference in behavior between the S4 cbind and base::cbind is that, unlike base::cbind, the S4 cb

Re: [Rd] Attributes of 1st argument in ...

2010-07-05 Thread Martin Maechler
> "DM" == Daniel Murphy > on Sun, 4 Jul 2010 11:11:43 -0700 writes: DM> Thank you, Professor, for drawing my attention to the nifty tracemem DM> function. I'm using the ..1 syntax to check the properties of the S4 class DM> at function call. DM> The Description at ?"

Re: [Rd] Attributes of 1st argument in ...

2010-07-04 Thread Daniel Murphy
Thank you, Professor, for drawing my attention to the nifty tracemem function. I'm using the ..1 syntax to check the properties of the S4 class at function call. The Description at ?"cBind" tells me that I'm not alone in this predicament. Just as Matrix needs its own cBind function, my package wil

Re: [Rd] Attributes of 1st argument in ...

2010-07-04 Thread Prof Brian Ripley
I think you have missed the use of ..1 etc: see e.g. cBind() in package Matrix. So x <- attr(list(...)[[1L]], "foo") can be x <- attr(..1, "foo") As for 'extra copying', it all depends on exactly what you are doing, but compare foo1 <- function(...) length(..1) foo2 <- function(...) length(

Re: [Rd] Attributes of 1st argument in ...

2010-07-03 Thread Daniel Murphy
Hi Hadley, My actual goal is to have a cbind method in the mondate package that behaves just like the base cbind function: class and shape of the result, names, etc. Perhaps it's due to the fact that 'cbind' uses its own internal dispatching, but I have not found a way to implement a "true" S3-sty

Re: [Rd] Attributes of 1st argument in ...

2010-07-03 Thread Hadley Wickham
Hi Dan, Is there a reason you can't change the function to f <- function(x, ...) {} ? Hadley On Fri, Jul 2, 2010 at 4:26 PM, Daniel Murphy wrote: > R-Devel: > > I am trying to get an attribute of the first argument in a call to a > function whose formal arguments consist of dots only and do s

Re: [Rd] Attributes of 1st argument in ...

2010-07-03 Thread Olaf Mersmann
Hi Daniel, On 02.07.2010, at 23:26, Daniel Murphy wrote: > I am trying to get an attribute of the first argument in a call to a > function whose formal arguments consist of dots only and do something, e.g., > call 'cbind', based on the attribute > f<- function(...) {get first attribute; maybe or m

Re: [Rd] Attributes of 1st argument in ...

2010-07-02 Thread Olaf Mersmann
Hi Daniel, On 02.07.2010, at 23:26, Daniel Murphy wrote: > I am trying to get an attribute of the first argument in a call to a > function whose formal arguments consist of dots only and do something, e.g., > call 'cbind', based on the attribute > f<- function(...) {get first attribute; maybe or m

[Rd] Attributes of 1st argument in ...

2010-07-02 Thread Daniel Murphy
R-Devel: I am trying to get an attribute of the first argument in a call to a function whose formal arguments consist of dots only and do something, e.g., call 'cbind', based on the attribute f<- function(...) {get first attribute; maybe or maybe not call 'cbind'} I thought of (ignoring "deparse.