I'm looking at this question in which someone is attempting to use MASS::rlm(method="MM")
from within geom_smooth()
in ggplot.
I thought this would be a grand opportunity for pryr::partial
, but have been confused by what I think is a dispatch issue.
First an example of what I think should work:
library(ggplot2)
library(MASS)
library(pryr)
dat <- data.frame(x=1:10, y=jitter(1:10))
rlm.mm <- partial(rlm, method="MM")
ggplot(dat, aes(x=x, y=y)) +
geom_smooth(method="rlm.mm")
Alas, I get the following error when attempting to plot:
Error in eval(expr, envir, enclos) :
the ... list does not contain 3 elements
My thinking is that this has to do with the ordering of parameters, with the named parameter usurping one of the positional arguments.
So, the question here is, is there a way to do partial application of this function where it is an optional, named argument that is supplied?