From c1072f8780ec214f62408046b75ed089e69094f0 Mon Sep 17 00:00:00 2001 From: HannesOberreiter Date: Tue, 27 Jul 2021 15:38:25 +0200 Subject: [PATCH] Update 20_Evaluation.Rmd --- 20_Evaluation.Rmd | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/20_Evaluation.Rmd b/20_Evaluation.Rmd index 32239a1d..0385ddf4 100755 --- a/20_Evaluation.Rmd +++ b/20_Evaluation.Rmd @@ -461,11 +461,7 @@ identical( __[Q3]{.Q}__: Another way to write `resample_lm()` would be to include the resample expression `(data[sample(nrow(data), replace = TRUE), , drop = FALSE])` in the data argument. Implement that approach. What are the advantages? What are the disadvantages? -__[A]{.solved}__: Different versions of `resample_lm()` were given in *Advanced R*. However, none of them implemented the resampling within the function argument. - -Different versions of `resample_lm()` (`resample_lm0()`, `resample_lm1()`, `resample_lm2()`) were specified in *Advanced R*. However, in none of these versions was the resampling step implemented in any of the arguments. - -This approach takes advantage of R's lazy evaluation of function arguments, by moving the resampling step into the argument definition. The user passes the data to the function, but only a permutation of this data (`resample_data`) will be used. +__[A]{.solved}__: Different versions of `resample_lm()` (`resample_lm0()`, `resample_lm1()`, `resample_lm2()`) were specified in *Advanced R*. However, none of them implemented the resampling within the function argument. The asked approach takes advantage of R's lazy evaluation of function arguments, by moving the resampling step into the argument definition. The user passes the data to the function, but only a permutation of this data (`resample_data`) will be used. ```{r} resample_lm <- function(