if else & for loop

if else



if ( condition ) {
    command1
} else {
    command2
}


if ( condition ) {
    command1
} else if (cond) {
    command2
} else if (cond) {
    command3
} else command4


if ( x > 100 )   y=1   else   y=0
if ( x > 100 ) { y=1 } else { y=0 }

if ( is.character(x) )  1 else 5

for loop


for (i in 1:20) command

for (i in 1:length(x))

for (i in v) {
  command1
  command2
}

Subpages (1): logical operators