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
This commit is contained in:
parent
c63f496ed9
commit
38cd5aa337
|
@ -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:
|
||||
|
||||
|
|
Loading…
Reference in New Issue