Learn R Programming

BBmisc (version 1.10)

coalesce: Returns first non-missing, non-null argument.

Description

Returns first non-missing, non-null argument, otherwise NULL.

Usage

coalesce(...)

Arguments

...
[any] Arguments.

Value

[any].

Examples

Run this code
f = function(x,y) {
  print(coalesce(NULL, x, y))
}
f(y = 3)

Run the code above in your browser using DataLab