if syntax in r code example
Example 1: if and else if in r
if ( test_expression1) {
statement1
} else if ( test_expression2) {
statement2
} else if ( test_expression3) {
statement3
} else {
statement4
}
Example 2: if in r
if (test_expression) {
statement
}