coalesce: A more versatile form of the T-SQL coalesce() function.
Description
Little more than a wrapper for vectorize, allows for duplication of SQL coalesce functionality, certain types of if-else statements, and apply/Reduce combinations.
Usage
coalesce(..., fun = (function(x, y) if (!is.na(x)) x else y))
Arguments
...
an arbitrary number of R objects
fun
a two argument function that returns an atomic value