# NOT RUN {
library(dplyr)
library(broom)
bootstrapify(iris, 5)
iris %>%
bootstrapify(5) %>%
summarise(per_strap_mean = mean(Petal.Width))
iris %>%
group_by(Species) %>%
bootstrapify(5) %>%
summarise(per_strap_species_mean = mean(Petal.Width))
iris %>%
bootstrapify(5) %>%
do(tidy(lm(Sepal.Width ~ Sepal.Length + Species, data = .)))
# Alternatively, use the newer group_modify()
iris %>%
bootstrapify(5) %>%
group_modify(~tidy(lm(Sepal.Width ~ Sepal.Length + Species, data = .x)))
# Alter the name of the group with `key`
# Materialize them with collect()
straps <- bootstrapify(iris, 5, key = ".straps")
collect(straps)
# }
Run the code above in your browser using DataLab