coalesce: Coalesce

Description Usage Arguments Value See Also Examples

View source: R/coalesce.R

Description

This function returns the first non-NA argument similar to the SQL function COALESCE(...). Coalescing is done element by element.

Usage

1

Arguments

...

vectors with values to coalesce.

Value

a vector of same length as the first input.

See Also

See the following StackOverflow answer for the source of this function.

Examples

1
2
3
coalesce(c("A", "B", NA, "D"), c("A", "B", "C", "D"))
coalesce(NA, NA, 3)
coalesce(c(1,NA,NA), c(NA,2))

tstev/tstevR documentation built on May 18, 2020, 10:57 p.m.