[R] Loading data into a list of environments
Powell, Jeff
Jeff.Powell at wur.nl
Sat May 31 22:44:01 CEST 2008
Dear All,
Thanks to an answer which I received from a previous post, I'm now able to create a series of
environments using the following:
nmes <- c("en1", "en2", "en3")
for(i in nmes) assign(i, new.env(parent = .GlobalEnv))
My next question is how, using "load", can I automatically place data into each of these
newly created environments.
The following, and variations thereof, does not work:
nmes <- c("en1", "en2", "en3")
for(i in nmes) load(file = "/home/testData/Data.RData", i)
I've tried, among other attempts, to use "as.environment(i)" without success. My "i" is seen
as a character, but I want it to be seen as the environment which it represents.
Kind regards,
J.Powell
LEI
Visserij
Alexanderveld 5
2585 DB Den Haag
The Netherlands
More information about the R-help
mailing list