The help page for ?"for" says that: The index seq in a for loop is evaluated at the start of the loop; changing it subsequently does not affect the loop. The variable var has the same type as seq, and is read-only: assigning to it does not alter seq.
The help file is not right when seq is a list() or other recursive type. In that case var has the type of seq[[i]] where i is the current iteration count. (I think this is true in general, since [ and [[ act the same for nonrecursive types when the indices are such that a scalar would be returned. However that explanation is unnecessarily complicated in the nonrecursive case.) Also, the variable var is not really read-only. You can alter it but it gets reset to the next value in seq at the start of each iteration. You cannot affect the meaning of 'next' to force it to, e.g, omit or repeat iterations. Bill Dunlap TIBCO Software Inc - Spotfire Division wdunlap tibco.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.