bootstrap {broom} | R Documentation |
Set up bootstrap replicates of a dplyr operation
bootstrap(df, m, by_group = FALSE)
df |
a data frame |
m |
number of bootstrap replicates to perform |
by_group |
If |
This code originates from Hadley Wickham (with a few small corrections) here:
https://github.com/hadley/dplyr/issues/269
Some examples can be found at
https://github.com/dgrtwo/broom/blob/master/vignettes/bootstrapping.Rmd
library(dplyr) mtcars %>% bootstrap(10) %>% do(tidy(lm(mpg ~ wt, .)))