Update iteration.Rmd (#231)

This commit is contained in:
Rademeyer Vermaak 2016-08-05 15:52:38 +02:00 committed by Hadley Wickham
parent c901ffd111
commit 238880b233
1 changed files with 1 additions and 1 deletions

View File

@ -228,7 +228,7 @@ Typically you'll be modifying a list or data frame with this sort of loop, so re
There are three basic ways to loop over a vector. So far I've shown you the most general: looping over the numeric indices with `for (i in seq_along(xs))`, and extracting the value with `x[[i]]`. There are two other forms:
1. Loop over the elements: `for (x in xs)`. This is most useful if you only
care about side-effects, liking plotting or saving a file, because it's
care about side-effects, like plotting or saving a file, because it's
difficult to save the output efficiently.
1. Loop over the names: `for (nm in names(xs))`. This gives you name, which