In interactive use, I occasionally need to bundle a largish set of
objects together in a list. To get a list in which the elements keep
their original names, I am forced to write something like
list(Object1=Object1, Object2=Object2, ..... , Object25=Object25).
Is there some straightforward way to place a set of named objects in a list, such that they 'keep' their names, without having to type nameXXX=nameXXX for each one?
cars <- mtcars[1:2,1:2]
vowels <- c("a","e","i","o","u")
consonants <- setdiff(letters, vowels)
## I'd like to get this result...
list(consonants=consonants, vowels=vowels, cars=cars)
## $consonants
## [1] "b" "c" "d" "f" "g" "h" "j" "k" "l" "m" "n" "p" "q" "r" "s" "t" "v" "w" "x"
## [20] "y" "z"
##
## $vowels
## [1] "a" "e" "i" "o" "u"
##
## $cars
## mpg cyl
## Mazda RX4 21 6
## Mazda RX4 Wag 21 6
## ... but by doing something more like
f(consonants, vowels, cars)