There are a couple of options: The help page for lapply also includes the help for sapply and sapply has a USE.NAMES argument that may do what you want (specify simplify=FALSE to force the same behavior as lapply).
You can post specify the names like: > names(mylist) <- vector.of.names Do either of those do what you want? -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of roger koenker > Sent: Thursday, July 23, 2009 8:20 AM > To: r-help@r-project.org > Subject: [R] Constructing lists (yet, again) > > 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. ______________________________________________ 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.