The help pages (here for bquote) are your friend.
I don't think you really want to do this via do.call(), as you want some
arguments evaluated and some unevaluated. Rather, match.call(), alter it
as you want, and then eval.parent it. Something like
ploteps <- function(file, plotFunction, ...)
{
Call <- match.call()
fn <- deparse(substitute(plotFunction))
Call[[1]] <- as.name(fn)
Call$file <- Call$plotFunction <- NULL
postscript(file=file)
eval.parent(Call)
dev.off()
}
ploteps("foo.eps", hist, xlab = "X", rnorm(100))
On Wed, 19 Nov 2008, Roberto Brunelli wrote:
> I'm trying to write a simple wrapper for plotting functions to make
> them print to postscript, something like
>
> ploteps <- function(file, plotFunction, ...) {
>
> args <- list(bquote(...))
>
> # prepare postscript device
>
> do.call(plot, args)
>
> # close postscript device
> }
>
> I have inserted the bquote otherwise I get a lot of numbers in the
> plot when I plot/hist something. But if I invoke the function as
>
> ploteps("foo.eps", hist, xlab = "X")
>
> I get
>
> Error in bquote(...) : unused argument(s) (xlab = "X")
>
> What am I messing up?
>
>
> Thanks a lot,
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595