initList {FastUtils}R Documentation

Initialize a List

Description

This function initializes a list based on size or names, with an optional initial value.

Usage

initList(x = NULL, initVal = NULL)

Arguments

x

A character vector as names, or an numeric indicating the size of the list.

initVal

an optional initial value for all elements of the list.

Value

A list of the specified size and names, optionally initialized with a value.

Examples

# Create a list with 3 elements
initList(3)
# Create a named list initialized with NULL
initList(c("a", "b", "c"))
# Create a list with 2 elements initialized with 0
initList(2, 0)

[Package FastUtils version 0.1.1 Index]