[R] how to automatically create objects with names from a string list?

Mark Farnell mark.farnell at gmail.com
Wed Jun 4 07:15:47 CEST 2008

Suppose I have a string of objects names:

name <- c("foo", "bar", "baz")

and I would like to use a for loop to automatically create three
objects called "foo", "bar" and "baz" accordingly.  Then how can this
be done" (so that in the workspace, foo = 1, bar = 2 and baz=3)

for (i in name) {



More information about the R-help mailing list