[R] really dumb question | loop counters in

Duncan Murdoch murdoch at stats.uwo.ca
Fri Sep 21 23:53:02 CEST 2007


On 21/09/2007 4:20 PM, Evan Cooch wrote:
> Paul Hiemstra wrote:
>> Hi,
>>
>> This works:
>>
>> for(i in seq(1,100,5)) {
>> print(i)
>> }
>>
>> Very similar to the way python does this kind of loop.
>>
> 
> Indeed it is - thanks for the tip. I'm still puzzled why I can't find a 
> single piece of the standard [R] language documentation that shows this. 
> In contrast, every single other language I use (more than I care to 
> admit), and documentation for same, feature this prominently when they 
> talk about looping.

It's in "9.2.2 Repetitive execution: for loops, repeat and while" of the 
Introduction to R manual. That's a good manual to read if you're looking 
for an introduction to R.

Duncan Murdoch



More information about the R-help mailing list