The package rsample contains a function for bootstrapping and another function which allows bootstrapping on groups of the data.
The grouped vesion is a lot slower (~2000 times). I was expecting it to be a bit slower, but I do not get why it is that much slower.
(The groups in my example are not meaningful, but this should be irrelevant for testing the speed of both functions.)
library(tidyverse)
library(rsample)
dat <- tibble(x = 1:1000)
microbenchmark::microbenchmark(
grouped = {
dat %>%
group_bootstraps(group = x, times = 10)},
simple = {
dat %>%
bootstraps(times = 10)},
times = 5)