I agree with Ben that you have not asked a question appropriate for
the ggplot2 list (the manipulatr list is the analogue to ggplot2-help
for (d)plyr/tidyr/reshape2 questions), but it may be of interest to
this group to know that the broom package has some really nice
features, many of which dovetail with ggplot2, and this is an
opportunity to show off one of them.
The bootstrap() function in broom can perform bootstrapping on
statistical models whose results are returned as a tidy data frame, so
it is appropriate for the question posed here. I used a cell means
model to get bootstrap CIs of the mean mpg by number of cylinders as
follows:
library(dplyr)
library(broom)
mtcars %>% bootstrap(999) %>%
do(tidy(lm(mpg ~ factor(cyl) - 1, data = .))) %>%
group_by(term) %>%
summarise(lcl95 = quantile(estimate, 0.025),
ucl95 = quantile(estimate, 0.975))
The bootstrap() and tidy() functions come from broom. It is probably
worth saving the results from the first two lines of code and inspect
the returned object, as it helps in understanding the last few lines.
HTH,
Dennis
> email to
ggplot2+u...@googlegroups.com.