+?library(purrr)
library(ggplot2)
g <- ggplot(mpg, aes(class))
# Geomのリスト
list(geom_bar(), geom_density(), geom_dotplot()) %>%
# Geomを適用する関数のリスト
map(~ partial(ggplot2:::`+.gg`, e2 = .)) %>%
# それをgに適用
invoke(g) %>%
# grid.arrangeは...なのでlift_dlでリストを渡す
lift_dl(gridExtra::grid.arrange)(.)
## `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.
これがggplot2:::+.ggじゃなくて+だとうまくいかない。
`+`
## function (e1, e2) .Primitive("+")
formals(`+`)
## NULL
e1, e2という引数があるっぽく見えて、そんなことはないらしい。