add_to_list: Add Element to Existing List

View source: R/S03_Utilities.R

add_to_listR Documentation

Add Element to Existing List

Description

A function that adds a new element to a pre-existing list. Allows greater compatibility with the pipe operator.

Usage

add_to_list(l, name, e)

Arguments

l

A list.

name

A character string, the name of the new element being added.

e

An R object, the new element to add to the list.

Value

A list with an additional element e with the specified name.

Examples

l <- list() |>
  add_to_list( 'A', 1:3 ) |>
  add_to_list( 'B', list( C = 1, D = 2 ) )
print(l)

rettopnivek/arfpam documentation built on Oct. 20, 2024, 7:24 p.m.