Categories

Nov 13, 2019 in R Language

Q: IF, ELSE, ELSE IF Statement in R

1 Answer

Nov 13, 2019

The if else statement

An if-else statement is a great tool for the developer trying to return an output based on a condition. In R, the syntax is:

if (condition) {
    Expr1 
} else {
    Expr2
}

The else if statement

We can further customize the control level with the else if statement. With elif, you can add as many conditions as we want. The syntax is:

if (condition1) { 
    expr1
    } else if (condition2) {
    expr2
    } else if  (condition3) {
    expr3
    } else {
    expr4
}
Click here to read more about Loan/Mortgage
Click here to read more about Insurance

Related questions

Madanswer
Nov 6, 2019 in R Language
Nov 4, 2019 in R Language
Jul 28, 2019 in R Language
...