The ifelse() function evaluates a logical object (usually a vector-valued logical condition) and returns an object of the same dimension with TRUE values replaced by a value, or vector of values, specified by the user, and FALSE values replaced similarly by a second value, or vector of values specified by the user. This function is handy, but its results can also be achieved with subscripted assignments, which may be quicker. This video introduces the ifelse() function and illustrates it. It also compares the ifelse() function with the use of a subscripted assignment statement.
The ifelse() function is not essential to R programming, but it is worth knowing, especially because it is easily understood and used. You may find that you can learn it quickly on your own, but this video will help.