Skip to contents

Keeps the original nested-list structure. Leaves for which .p returns FALSE are replaced by NULL.

Usage

list_filter(.x, .p, .progress = FALSE)

Arguments

.x

A nested list to traverse.

Lists are traversed recursively. Non-list objects are treated as leaves. Data frames are not traversed and are treated as leaf values.

.p

A predicate function, formula, or function-like object coercible by rlang::as_function().

.progress

Whether to show a progress

Use TRUE to turn on a basic progress, use a string to give it a name, or use a list to customize the progress bar (see ?cli::cli_progress_bar and https://cli.r-lib.org/articles/progress-advanced.html#cli_progress_bar for details).

Value

A nested list with the same structure and names as .x.