This is an attempt to rescue an old R-help question that apparently received no response from the oblivion of collective silence, and besides I'm also
curious about the answer

From: Griffith Feeney (gfee...@hawaii.edu)
Date: Fri 28 Jan 2000 - 07:48:45 EST   wrote (to R-help)
Constructing lists with

list(name1=name1, name2=name2, ...)

is tedious when there are many objects and names are long. Is there an R function that takes a character vector of object names as an argument and
returns a list with each objected tagged by its name?

The idiom

        lapply(ls(pat = "^name"), function(x) eval(as.name(x)))

makes the list, but (ironically) doesn't assign the names to the components.



url:    www.econ.uiuc.edu/~roger            Roger Koenker
email    rkoen...@uiuc.edu            Department of Economics
vox:     217-333-4558                University of Illinois
fax:       217-244-6678                Urbana, IL 61801

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to