制御フロー

if

if(cond) expr
if(cond) cons.expr else alt.expr
R: Control Flow
> for(i in 1:10) {
+ print(i)
+ if(2<i) break
+ }
[1] 1
[1] 2
[1] 3

関係演算子

switch

switch(EXPR, ...)
R: Select One of a List of Alternatives

for

for(var in seq) expr
> for(i in 1:3) print(i)
[1] 1
[1] 2
[1] 3
> for(i in c("a","b")) print(i)
[1] "a"
[1] "b"

break

break

next

next

while

while(cond) expr

repeat

repeat expr