The "for" loop syntax is as follows:
for(index in set){ statement(s) }
Example:
for(i in 1:2)print(i)
Please see "help('for')", or any good basic reference on S, S-Plus
or R, e.g., the "for" loops in the on-line Programmer's Guide. There
are also many other documents describing the language downloadable,
e.g., from "www.r-project.org". I highly recommend Venables and Ripley
(2002) Modern Applied statistics with S, 4th ed. (Springer).
hope this helps. spencer graves
Gerald E Bove Jr wrote:
when i create a loop to test cases in a particular column in a matrix why
does it loop for only one iteration even though test condition is not met?
ex. for (i in fp[,2]) if (condition) (assignment)
have tried several variations on first part of expression but always get
same result, won't loop past first iteration, is my for statement bad? how
can i search a particular column of data, test cases, save results, test
next column with new condition then total over 3rd column based on first 2
results. Not to difficult a program if loop would work.
thanks
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu. To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message: unsubscribe s-news
|