Getting my feet wet with purrr.
I'm evaluating different combinations of parameters for a beta distribution and I'm trying to pass a vector of x values and the parameters for the distribution.
See the code below:
library(tidyr)
library(purrr)
library(dplyr)
x <- seq(0.01, 0.99, 0.01)
alpha <- c(0.1, 0.5, 1:5, 10)
beta <- c(0.5, 1, 2, 5)
df <- expand.grid(alpha = alpha, beta = beta, x = x) %>%
nest(x) %>%
mutate(plotdata = pmap(list(data$x, alpha, beta), dbeta)) %>%
unnest()
What's the right syntax for pmap in this case?