list.fromNames: Create a Named List from a Character Vector of Names, or a...

View source: R/CodeAndRoll2.R

list.fromNamesR Documentation

Create a Named List from a Character Vector of Names, or a names of an object

Description

This function takes a character vector of names and creates a list where each element is named according to the character vector and filled with a specified value.

Usage

list.fromNames(x = LETTERS[1:5], fill = NaN, use.names = FALSE)

Arguments

x

A character vector of names, with a default of the first five letters of the alphabet.

fill

The value used to fill the elements of the list, with a default of NaN.

use.names

Logical. If TRUE, the names of the input vector are used as names for the list.

Value

A named list with elements filled with the specified value.

Examples

list.fromNames() # Default behavior with `LETTERS[1:5]` and `NaN`

vertesy/CodeAndRoll2 documentation built on Nov. 20, 2024, 5:23 a.m.