You need the in dev version of dplyr
#library(devtools)
#install_github("tidyverse/dplyr")
library(tidyverse)
library(broom)
calculate_ci <- function(d, x, ...) {
d %>%
group_by(...) %>%
group_map(~t.test(.x %>% pull(!!enquo(x)), conf.int = TRUE) %>% tidy())
}
In the data mtcars, we group mpg by gear and am and calculate the confidence intervals
mtcars %>% calculate_ci(mpg, gear, am)