0

I've got a list that I have saved. I want to load the list, and then have all of its elements transferred to the global environment. Or, equivalently, to a function's environment if the object is loaded inside a function.

Here is a simple example. How can I automate the last few lines?

L <- list(goats = 'goats', cheese = 'cheese'
, numbarz = 1:5, nice.model = lm(rnorm(100)~rexp(100)))
save(L, 'L.Rda')
rm(L)
load('L.Rda')
goats <- L$goats
cheese <- L$cheese
numbarz <- L$numbarz
nice.model <- L$nice.model
generic_user
  • 3,430
  • 3
  • 32
  • 56

0 Answers0