coalesce: Replace NA values

View source: R/coalesce.R

coalesceR Documentation

Replace NA values

Description

Returns the first non-NA argument, similar to the SQL function coalesce. If a vector or matrix is passed as first argument, the remaining arguments are recycled to generate a vector/matrix of the same dimension, and coalescing is done element by element. Taken from krlmlr's misc package, referenced at StackOverflow.

Usage

coalesce(x, ...)

Arguments

x

The first value to coalesce.

...

Other values to coalesce.

Value

A vector of the same length as x.


crazybilly/ucbudar documentation built on July 15, 2024, 5:03 p.m.