listNamed: Create a list with names from object names

View source: R/listNamed.R

listNamedR Documentation

Create a list with names from object names

Description

This is a convenience wrapper around ⁠newList <- list(a = 1); names(newList) <- "a"⁠.

Usage

listNamed(...)

Arguments

...

Any elements to add to a list, as in base::list

Details

This will return a named list, where names are the object names, captured internally in the function and assigned to the list. If a user manually supplies names, these will be kept (i.e., not overwritten by the object name).

Examples

a <- 1
b <- 2
d <- 3
(newList <- listNamed(a, b, dManual = d)) # "dManual" name kept



reproducible documentation built on June 22, 2024, 10:18 a.m.