coalesce_r: Recursively coalesce list elements.

View source: R/teal_slices.R

coalesce_rR Documentation

Recursively coalesce list elements.

Description

Returns first element of list that it not NULL, recursively.

Usage

coalesce_r(x)

Arguments

x

(list), either of atomic vectors or of named lists

Details

Given a list of atomic vectors, the first non-null element is returned. Given a list of lists, for all names found in all elements of the list the first non-null element of a given name is returned.

This function is used internally in c.teal_slices to manage teal_slices attributes.

Value

Either an atomic vector of length 1 or a (potentially nested) list.


teal.slice documentation built on May 29, 2024, 1:39 a.m.