coalesce_across: Coalesce with *tidyselect* Semantics

View source: R/utils.R

coalesce_acrossR Documentation

Coalesce with tidyselect Semantics

Description

Given a set of data frame columns (potentially using <tidy-select>), coalesce_across() finds the first non-missing value at each position.

Usage

coalesce_across(.cols)

Arguments

.cols

<tidy-select> Columns to transform. Because across() is used within functions like summarise() and mutate(), you can't select or compute upon grouping variables.

Details

coalesce_across() is a wrapper around coalesce() that allows specification of columns using <tidy-select> semantics. It does this using across(), which means it is only designed to work inside dplyr verbs. In other cases, just use coalesce().

Value

A vector the same length as the first ... argument with missing values replaced by the first non-missing value.


jesse-smith/coviData documentation built on Jan. 14, 2023, 11:08 a.m.