Is there a way to use two ‘…’ statements in a function in R?
An automatic way: foo.plot <- function(x,y,…) { lnames <- names(formals(legend)) pnames <- c(names(formals(plot.default)), names(par())) dots <- list(…) do.call(‘plot’, c(list(x = x, y = x), dots[names(dots) %in% pnames])) do.call(‘legend’, c(“bottomleft”, “bar”, pch = 1, dots[names(dots) %in% lnames])) } pch must be filtered from the lnames to avoid duplication in the legend call in case the user … Read more