Skip to content
Prev 5554 / 12125 Next

[R-pkg-devel] Forward function call

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 on survival. Now I am thinking of changing 
Depends to Imports, and I would like to change the code to

     if (cox.ph){
         Call <- match.call()
         Call[[1]] <- as.name("survival::coxph")
         fit <- eval.parent(Call)
         return(fit)
     }

but this doesn't work, because the function name is turned into
`survival::coxph` (with the backticks) and the evaluation fails.

How can I solve this?

Thanks, G,