Update iteration.Rmd

Correcting typo in exercise code
This commit is contained in:
MJMarshall 2016-03-26 10:07:13 +00:00
parent 5c7cf27b2a
commit d8f3bbddb4
1 changed files with 1 additions and 1 deletions

View File

@ -130,7 +130,7 @@ That's all there is to the for loop! Now is a good time to practice creating som
x <- sample(100) x <- sample(100)
sd <- 0 sd <- 0
for (i in seq_along(out)) { for (i in seq_along(x)) {
sd <- sd + (x[i] - mean(x)) ^ 2 sd <- sd + (x[i] - mean(x)) ^ 2
} }
sd <- sqrt(sd) / (length(x) - 1) sd <- sqrt(sd) / (length(x) - 1)