Re: [R] for loop step

2008-05-20 Thread Erik Iverson
You are doing it in your bit about 1:10, which is shorthand for generating a sequence 1, 2, 3, ..., 9, 10. Use ?seq to do what you want. for(i in seq(1, 10, by = 2)) cat(i, "\n") Best, Erik Nair, Murlidharan T wrote: How do I define the incremental step in a "for" loop? for (j in 1:10){

[R] for loop step

2008-05-20 Thread Nair, Murlidharan T
How do I define the incremental step in a "for" loop? for (j in 1:10){ cat(j, "\n") } In the above example, if I want to increment j by 2 where do I specify that? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mail