On 11/02/2010 9:28 AM, Fabrizio Pollastri wrote:
Hello,
there is compact way to skip a for loop when the requested number of
iterations is 0 ?
For example, something equivalent to the following code:
for (i in some_function(from=1,to=iteration_cycles)) { ... }
Where the loop is skipped when iteration_cycles==0
Sure:
for (i in seq_len(iteration_cycles)) { ... }
will execute 0 times if requested.
Duncan Murdoch
______________________________________________
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.