compact2: Remove all zero-length elements from list ignoring AsIs...

View source: R/utils-query.R

compact2R Documentation

Remove all zero-length elements from list ignoring AsIs elements

Description

This function wraps the compact function to recursively remove elements from lists that have zero length, but spares the elements wrapped in I which mean something specific when passing as JSON.

Usage

compact2(.x, .p = identity)

Arguments

.x

list or vector

.p

function; predicate function that identifies elements to discard

Value

list containing no empty elements, but does leave anything that has been wrapped in I() making the class AsIs which signals to toJSON not to drop the value, but to set as null.

Note

This function is meant to be used internally. Only use when debugging.


salesforcer documentation built on March 18, 2022, 6:26 p.m.