How does bootstrapping in R actually work? I've been looking into the boot package in R and while I have found a number of good primers on how to use it, I have yet to find anything that describes exactly what is happening "behind the scenes". For instance, in this example, the guide shows how to use standard regression coefficients as a starting point for a bootstrap regression but doesn't explain what the bootstrap procedure is actually doing to derive the bootstrap regression coefficients. It appears there is some sort of iterative process that is happening but I can't seem to figure out exactly what is going on.
 A: You should focus on the function that is passed to boot as the "statistic" parameter and notice how it is constructed.
f <- function(data, i) {
  require(pscl)
  m <- zeroinfl(count ~ child + camper | persons,
    data = data[i, ], dist = "negbin",
    start = list(count = c(1.3711, -1.5152, 0.879), zero = c(1.6028, -1.6663)))
  as.vector(t(do.call(rbind, coef(summary(m)))[, 1:2]))
}

The "data" argument is going to receive an entire data frame, but the "i" argument is going to receive a sample of row indices generated by the "boot" and taken from 1:NROW(data). As you can see from that code, "i" is then used to create a neo-sample which is passed to zeroinl and then only selected portions of it's results are returned. 
Let's imagine that "i" is {1,2,3,3,3,6,7,7,10}. The "[" function will return just those rows with 3 copies of row 3 and 2 copies of row 7. That would be the basis for a single zeroinl() calculation and then the coefficients will be returned to boot as the result from that replicate of the process. The number of such replicates is controlled by the "R" parameter.
Since only the regression coefficients are returned from statistic in this case, the boot function will return  these accumulated coefficients as the value of "t". Further comparisons can be performed by other boot-package functions.
