I would like to use ... to pass arguments into ggplot in a different function. For example:
dat <- data.frame(x = c(1, 2, 3), y = c(1, 2, 3))
f <- function(dat) {
ylimits = c(min(dat$x, dat$y), max(dat$x, dat$y))
g(dat, ylim = ylimits)
}
g <- function(dat, ...) {
args <- eval(substitute(alist(...)))
ggplot(dat, aes(x = x, y = y)) + geom_point() + coord_cartesian(ylim = args[['ylim']])
}
f(dat)
I tried using eval(args[['ylim']]), various combinations of quote/deparse/substitute but I haven't been able to get it to evaluate properly.

args <- list(...)? That works for me. - BrodieG