rlply | R Documentation |
Evalulate expression n times then combine results into a list
rlply(.n, .expr, .progress = "none")
.n |
number of times to evaluate the expression |
.expr |
expression to evaluate |
.progress |
name of the progress bar to use, see |
This function runs an expression multiple times, and combines the
result into a list. If there are no results, then this function will return
a list of length 0 (list()
). This function is equivalent to
replicate
, but will always return results as a list.
list of results
Hadley Wickham (2011). The Split-Apply-Combine Strategy for Data Analysis. Journal of Statistical Software, 40(1), 1-29. https://www.jstatsoft.org/v40/i01/.
mods <- rlply(100, lm(y ~ x, data=data.frame(x=rnorm(100), y=rnorm(100))))
hist(laply(mods, function(x) summary(x)$r.squared))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.