[R] incrementing for loop by 2

Dimitris Rizopoulos Dimitris.Rizopoulos at med.kuleuven.be
Thu Jul 24 16:25:45 CEST 2008

you can define the 'seq' argument of for() accordingly, e.g.,

for(i in seq(0, 20, 2)) print(i)

I hope it helps.


Dimitris Rizopoulos
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/

Quoting "Clark, Jennifer H" <jclar2 at Central.UH.EDU>:

> Dear List-serv members:
> How can I structure a for loop so that it will increment the counter  
>  by two using R?  I am just looking for a simple example that shows   
> where the incrementing part should go.  Thanks!
> Jennifer
> --
> Jennifer Hayes Clark
> Assistant Professor
> Department of Political Science
> University of Houston
> Houston, TX 77204-3011
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at 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.

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

More information about the R-help mailing list