From a0fb7283b05b9afabe22b06071b44be18a972d27 Mon Sep 17 00:00:00 2001 From: OaCantona Date: Sat, 26 Mar 2016 11:40:27 +0100 Subject: [PATCH] Difference in code --- iteration.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iteration.Rmd b/iteration.Rmd index 78438dc..c0ddfc8 100644 --- a/iteration.Rmd +++ b/iteration.Rmd @@ -100,7 +100,7 @@ Every for loop has three components: it's easy to create them accidentally. If you use `1:length(x)` instead of `seq_along(x)`, you're likely to get a confusing error message. -1. The __body__: `output[i] <- median(df[[i]])`. This is the code that does +1. The __body__: `output[[i]] <- median(df[[i]])`. This is the code that does the work. It's run repeatedly, each time with a different value for `i`. The first iteration will run `output[[1]] <- median(df[[1]])`, the second will run `output[[2]] <- median(df[[2]])`, and so on.