The do() function facilitates easy replication for randomization tests and bootstrapping (among other things). Part of what makes this particularly useful is the ability to cull from the objects produced those elements that are useful for subsequent analysis. cull_for_do does this culling. It is generic, and users can add new methods to either change behavior or to handle additional classes of objects.

cull_for_do(object, ...)

Arguments

object

an object to be culled

...

additional arguments (currently ignored)

Details

When do(n) * expression is evaluated, expression is evaluated n times to produce a list of n result objects. cull_for_do is then applied to each element of this list to extract from it the information that should be stored. For example, when applied to a object of class "lm", the default cull_for_do extracts the coefficients, coefficient of determinism, an the estimate for the variance, etc.

Examples

cull_for_do(lm(length ~ width, data = KidsFeet))
#>   Intercept    width    sigma r.squared        F numdf dendf
#> 1  9.817212 1.657624 1.024769 0.4110041 25.81878     1    37
do(1) * lm(length ~ width, data = KidsFeet)
#> Using parallel package.
#>   * Set seed with set.rseed().
#>   * Disable this message with options(`mosaic:parallelMessage` = FALSE)
#>   Intercept    width    sigma r.squared        F numdf dendf .row .index
#> 1  9.817212 1.657624 1.024769 0.4110041 25.81878     1    37    1      1