listn: Generate a list object with names

View source: R/listn.r

listnR Documentation

Generate a list object with names

Description

Generate a list object with names.

Usage

listn(...)

Arguments

...

individual objects to be included in a list.

Details

This generates a list object by addressing the naming problem. For list, if no names are given, the list generated will have no names. In some situations, the number of individual objects is large and the names of these individual objects can be used as the names. This function addresses this need. If names are given, they will be used. If not, the names of individual objects will be used.

Value

Return a list object with names.

Author(s)

Changyou Sun (cs258@msstate.edu)

Examples


y1 <- 1:10
y2 <- c("a", "b")
listn(y1, y2)
listn(y1 = y1, y2)
listn(y1 = y1, y2.rev = y2, y2, 5:8, c("d", "f"))

identical(listn(y1, y2), listn(y1 = y1, y2))        # TRUE
identical(listn(y1, y2), list(y1 = y1, y2))        # FALSE
identical(listn(y1, y2), list(y1 = y1, y2=y2))     # TRUE

erer documentation built on April 18, 2022, 5:06 p.m.