"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 <maech...@stat.math.ethz.ch> wrote: > > >>>>> 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 that's where/how I assume it also came to Ben > Bolker, lme4, etc) : > > A simple grep inside current R's source <R>/src/library/ gives > > grep -r --color -nHF -e 'quote(stats::' > > ./stats/R/acf.R:28: m[[1L]] <- quote(stats::pacf) > ./stats/R/aggregate.R:154: m[[1L]] <- quote(stats::model.frame) > ./stats/R/aov.R:36: lmcall[[1L]] <- quote(stats::lm) > ./stats/R/bartlett.test.R:86: m[[1L]] <- quote(stats::model.frame) > ./stats/R/cor.test.R:213: m[[1L]] <- quote(stats::model.frame) > ./stats/R/factanal.R:73: mf[[1L]] <- quote(stats::model.frame) > ./stats/R/friedman.test.R:92: m[[1L]] <- quote(stats::model.frame) > ./stats/R/ftable.R:150: m[[1L]] <- quote(stats::model.frame) > ./stats/R/glm.R:52: mf[[1L]] <- quote(stats::model.frame) > ./stats/R/glm.R:863: fcall[[1L]] <- quote(stats::glm) > ./stats/R/lm.R:34: mf[[1L]] <- quote(stats::model.frame) > ./stats/R/lm.R:546: fcall[[1L]] <- quote(stats::model.frame) > ./stats/R/loess.R:34: mf[[1L]] <- quote(stats::model.frame) > ./stats/R/manova.R:22: fcall[[1L]] <- quote(stats::aov) > ./stats/R/model.tables.R:485: fcall <- c(list(quote(stats::model.frame)), > args) > ./stats/R/nls.R:570: mf[[1L]] <- quote(stats::model.frame) > ./stats/R/ppr.R:30: m[[1L]] <- quote(stats::model.frame) > ./stats/R/prcomp.R:69: mf[[1L]] <- quote(stats::model.frame) > ./stats/R/princomp.R:30: mf[[1L]] <- quote(stats::model.frame) > ./stats/R/quade.test.R:102: m[[1L]] <- quote(stats::model.frame) > ./stats/R/spectrum.R:220: m[[1L]] <- quote(stats::plot.spec.coherency) > ./stats/R/spectrum.R:226: m[[1L]] <- quote(stats::plot.spec.phase) > ./stats/R/t.test.R:141: m[[1L]] <- quote(stats::model.frame) > ./stats/R/ts.R:744: m[[1L]] <- quote(stats::window) > ./stats/R/var.test.R:97: m[[1L]] <- quote(stats::model.frame) > ./stats/R/xtabs.R:40: m[[1L]] <- quote(stats::model.frame) > > > > 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 <goran.brost...@umu.se> > 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 <- 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, > >>> > >>> ______________________________________________ > >>> R-package-devel@r-project.org mailing list > >>> https://stat.ethz.ch/mailman/listinfo/r-package-devel > > > ______________________________________________ > > R-package-devel@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-package-devel > > ______________________________________________ > R-package-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-package-devel ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel