[R] for loop help

From: tom soyer <tom.soyer_at_gmail.com>
Date: Thu, 10 Apr 2008 21:26:12 -0500


I am trying to find a solution in R for the following C++ code that allows one to skip ahead in the loop:

for (x = 0; x <= 13; x++){
 cout << "Hello World";

Note that "Hello World" was printed only twice using this C++ loop. I tried to do the same in R:

for(i in 1:13){
 print("Hello World")

It doesn't work as I expected, i.e., this R loop prints "Hello World" 13 times.

Does anyone know how to do it in R?



	[[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 11 Apr 2008 - 02:28:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 11 Apr 2008 - 05:30:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive