I'm having an issue while using pmap() with tidyeval and ggplot(). Not sure what I'm missing.
The code below works as desired:
library(tidyverse)
scatter_plot <- function(x,y,alpha, facet){
x_val <- enquo(x)
y_val <- enquo(y)
facet_var <- enquo(facet)
ggplot(iris, aes(!!x_val, !!y_val, alpha=alpha)) + geom_point() +
facet_wrap(vars(!!facet_var),ncol = 3)
}
scatter_plot(Petal.Length, Sepal.Length, 0.5, Species)

However using pmap() to pass a list of argument vectors doesn't give the desired plots:
x <- c("Petal.Length","Petal.Width")
y <- c("Sepal.Length","Sepal.Width")
alpha <- c(0.4,0.8)
facet <- rep("Species",2)
pmap(list(x,y,alpha,facet), scatter_plot)
#> [[1]]

#>
#> [[2]]

Created on 2018-11-06 by the reprex package (v0.2.1)