# avoid df as an object name, as an object of that name
# is always in the namespace, and some operations interpret
# the name as a closure
mk_df <- function(x) {
dat <- rnorm(x)
dat
}
apply(replicate(n = 10, expr = mk_df(5)), 2,mean)
#> [1] 0.38782911 0.77414331 0.61026993 -1.00028940 0.11886385 0.48070768
#> [7] -0.07799182 -0.85150985 -0.27631772 -0.11024515
Created on 2020-09-30 by the reprex package (v0.3.0.9001)