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.