add_list_null: Add 'list(NULL)' to an existing list in place of absent...

View source: R/add_list_null.R

add_list_nullR Documentation

Add list(NULL) to an existing list in place of absent elements

Description

This function adds list(NULL) to a list at all the elements in a user-supplied vector that are NULL.

Usage

add_list_null(l, elm)

Arguments

l

A list.

elm

A character vector which defines list element names at which the function should check whether those elements exist and, if not, replace them with list(NULL).

Value

A list, exactly as inputted, but in which NULL elements have been replaced by list(NULL).

Author(s)

Edward Lavender

Examples


l <- list(a = 10, b = 5, c = 4, d = NULL)
add_list_null(l, "d")
add_list_null(l, "e")


edwardlavender/utils.add documentation built on Dec. 14, 2024, 8:11 a.m.