[R] for loop the can be skipped
Duncan Murdoch
murdoch at stats.uwo.ca
Thu Feb 11 15:30:58 CET 2010
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
More information about the R-help
mailing list