Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

listn

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

Empirical Research in Economics with R

v3.0
GPL (>= 2)
Authors
Changyou Sun <cs258@msstate.edu>
Initial release
2020-04-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.