Suppose I have a function f(...) which internally calls different functions which both happen to take arguments with the name color. In some cases I want to send my ... argument to one, and sometimes the other. Is there some way to specify which one I mean when calling f()?
Here's a simple example.
library(ggplot2)
f <- function(...) {
  ggplot(mtcars, aes(disp, mpg)) +
    geom_point(aes(...), ...)
}
# in this case I want it OUTSIDE aes()
f(color = "blue") # should be geom_point(color = blue)

# here I want it INSIDE aes()
f(color = cyl) # should be geom_point(aes(color = cyl))
#> Error in list2(na.rm = na.rm, ...): object 'cyl' not found
Created on 2022-11-04 with reprex v2.0.2
 
    

