On Sun, Nov 30, 2008 at 12:21 PM, Salas, Andria Kay <[EMAIL PROTECTED]> wrote:
> I am running a large for loop and at the end of each iteration a matrix is 
> produced.  The program changes the columns in the matrix, and each time a 
> column is added the name of that column is "y".  All original columns have no 
> column name.  Due to the nature of the program, all original columns will 
> eventually be replaced with new columns each with the column name "y". It is 
> at this point that I want the program to stop running the for loop (right now 
> I just have it running for 20 iterations resulting in a matrix with a mix of 
> old and new columns).  I was thinking maybe I could do something with an if 
> else statement and the command colnames.  For example:
>
> If(colnames all are "y") (stop) else (run the program again)

Have a look at ?"while" :

while(!(colnames all are "y")) { run the program again }

Hadley

-- 
http://had.co.nz/

______________________________________________
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.

Reply via email to