From 38cd5aa3376764a6cae8796356d7f124eae13468 Mon Sep 17 00:00:00 2001 From: twgardner2 Date: Wed, 24 Oct 2018 13:26:03 -0400 Subject: [PATCH] Reword amount of code reduction (#685) * Update iteration.Rmd * Update iteration.Rmd Rewording the amount of code reduction due to generalizing code with a function --- iteration.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iteration.Rmd b/iteration.Rmd index a8e2a3f..7561624 100644 --- a/iteration.Rmd +++ b/iteration.Rmd @@ -438,7 +438,7 @@ Hopefully, you'd notice that there's a lot of duplication, and extract it out in f <- function(x, i) abs(x - mean(x)) ^ i ``` -You've reduced the chance of bugs (because you now have 1/3 less code), and made it easy to generalise to new situations. +You've reduced the chance of bugs (because you now have 1/3 of the original code), and made it easy to generalise to new situations. We can do exactly the same thing with `col_mean()`, `col_median()` and `col_sd()` by adding an argument that supplies the function to apply to each column: