The functions ifelse() and switch() execute flow control at the console or within a function or script. The ifelse() function evaluates a logical expression and chooses one of two values based on the result. The switch() function takes a value as an argument and returns another value based on the value of the first argument.
The ifelse( ) Function
The ifelse() function chooses what value to return based on whether the first argument ...