ifelse command in r meaning code example
Example: r if else
if (test_expression) {
code to run if test_expression is true
}
if (test_expression) {
code to run if test_expression is true
}
else {
code to run if test_expression is false
}
if (test_expression_1) {
code to run if test_expression_1 is true
}
else if (test_expression_2) {
code to run if test_expression_2 is true
}
if (test_expression_1) {
code to run if test_expression_1 is true
}
else if (test_expression_2) {
code to run if test_expression_1 is true
}
else {
code to run if both expressions are false
}