Re: [R-pkg-devel] Forward function call

2020-06-09 Thread Jan Gorecki
"pkg::fun" cannot be a name because it is a function call already `::`(pkg, fun). On Tue, Jun 9, 2020 at 8:10 AM Martin Maechler wrote: > > > Göran Broström > > on Mon, 8 Jun 2020 23:02:30 +0200 writes: > > > Thanks for the responses! > > I found the suggestion > > >

Re: [R-pkg-devel] Forward function call

2020-06-09 Thread Martin Maechler
> Göran Broström > on Mon, 8 Jun 2020 23:02:30 +0200 writes: > Thanks for the responses! > I found the suggestion > Call[[1]] <- quote(survival::coxph) > easiest to implement. And it works. and it is what we use in R's own R source code in several places (and

Re: [R-pkg-devel] Forward function call

2020-06-08 Thread William Dunlap
Use Call[[1]] <- quote(survival::coxph) Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Jun 8, 2020 at 12:12 PM Göran Broström wrote: > Hello, > > the function 'coxreg' in my package 'eha' is often just a wrapper for > 'coxph' in survival, so I have code like > > if (cox.ph){ >

Re: [R-pkg-devel] Forward function call

2020-06-08 Thread Göran Broström
Thanks for the responses! I found the suggestion Call[[1]] <- quote(survival::coxph) easiest to implement. And it works. Best, Göran On 2020-06-08 21:42, Ben Bolker wrote: I think quote(survival::coxph) will work in place of as.name() ? On Mon, Jun 8, 2020 at 3:12 PM Göran Broström

Re: [R-pkg-devel] Forward function call

2020-06-08 Thread Ben Bolker
I think quote(survival::coxph) will work in place of as.name() ? On Mon, Jun 8, 2020 at 3:12 PM Göran Broström wrote: > > Hello, > > the function 'coxreg' in my package 'eha' is often just a wrapper for > 'coxph' in survival, so I have code like > > if (cox.ph){ > Call <-

Re: [R-pkg-devel] Forward function call

2020-06-08 Thread Neal Fultz
You will first need to convert the function call to an expression, then you can modify the expression as appropriate. Here's a somewhat contrived minimal example: > f <- function(z, ...) match.call() > aaa = f(a=1,2,3) > str(aaa) language f(z = 2, a = 1, 3) > aaa <- as.expression(aaa) >

[R-pkg-devel] Forward function call

2020-06-08 Thread Göran Broström
Hello, the function 'coxreg' in my package 'eha' is often just a wrapper for 'coxph' in survival, so I have code like if (cox.ph){ Call <- match.call() Call[[1]] <- as.name("coxph") fit <- eval.parent(Call) return(fit) } which works since eha depends