Lightweight version of
dplyr::coalesce, with all the vices and virtues that come from such an
Very similar logic (and timings to
dplyr::coalesce), though no ability to use quosures etc.
One exception is that if
x does not contain any missing values, it is returned immediately,
.... For example,
dplyr::coalesce(1:2, 1:3) is an error, but
hutils::coalesce(1:2, 1:3) is not.
Successive vectors whose values will replace the corresponding values in
x with missing values replaced by the first non-missing corresponding elements in
That is, if
... = A, B, C and
x[i] is missing, then
x[i] is replaced by
x[i] is still missing (i.e.
A[i] was itself
NA), then it
is replaced by
C[i] until it is no longer missing or the list has been exhausted.
Original source code but obviously inspired by
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.