coalesce_rows: Get first non-missing

View source: R/wrangling_data.R

coalesce_rowsR Documentation

Get first non-missing

Description

For use with dplyr::summarise, for example

Usage

coalesce_rows(x)

Arguments

x

A vector

Details

This function operates similarly to coalesce for columns, that is picking the first non-missing observation, but on observations rather than variables.

Value

A single value

Source

https://stackoverflow.com/questions/40515180/dplyr-how-to-find-the-first-non-missing-string-by-groups

Examples

dplyr::summarise(emperors$wikipedia, coalesce_rows(emperors$wikipedia))
coalesce_rows(emperors$wikipedia$Beg)

globalgov/qData documentation built on April 10, 2022, 8:48 a.m.