Update iteration.Rmd (#231)
This commit is contained in:
parent
c901ffd111
commit
238880b233
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue