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)

manydata documentation built on July 9, 2023, 6:29 p.m.