#' ISWR exercise 1.5
#'
#' @description Solution to exercise 1.1 from Basics in Dalgaard P. Introductory
#' statistics with R. New York : Springer; 2008.
#'
#' @description “On p. 27, `replicate` was used to simulate the distribution of
#' the mean of 20 random numbers from the exponential distribution by repeating
#' the operation 10 times. How would you do the same thing with `sapply`?”
#'
#' @return Returns the result of the expression in question.
#' @import tidyverse
#' @export
#'
#' @examples
#' exercise_1_5()
exercise_1_5 <- function() {
sapply(integer(10),
eval.parent(substitute(function(...) mean(rexp(20)))),
simplify = simplify)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.