Dear Julian,
Try something like
lapply(objects(regexpr='foo.?'), function(x) eval(parse(text=x)))
(The syntax for objects() works a bit differently in different version of
S-PLUS, but your question implies that you already have the character
vector of names.)
I hope that this helps,
John
At 03:56 PM 5/22/2002 +0100, you wrote:
I'm trying to do something like
foo.list <- list(foo.1, foo.2, ...., foo.n)
where foo.n are n vectors
There must be a more elegant way to create these n arguments than
laboriously typing in "foo.1"... "foo.n", but so far my attempts to deduce
this have only produced foo.list with character string elements "foo.n"
rather than the objects foo.n -- i.e. I get
>foo.list
[[1]]:
"foo.1"
# etc. rather than
>foo.list
[[1]]:
[1] # lots of numbers go here
For the avoidance of doubt, I'm *not* interested in naming the elements of
foo.list -- i.e. I don't want
>foo.list
$foo.1:
[1] # lots of numbers go here
-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox@mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------
|